/* Ene Adriana Mihaela
* Licenta - Aplicatie pentru cursul de 
* elemente de grafica pe calculator
*/
#include <Windows.h>
#include <math.h>
#include "constante.h"

Camera *c;
Light *l;

void init_Scenarii(void) {
	scene[0] = Scenariu();
	current_scene = 0;
	scene[0].M->AddButton(new buton (0.25F,0.8F, 0.5f,0.05f, 0,0, "1. Transformari 2D", Functiecallback));
	scene[0].M->AddButton(new buton (0.25F,0.7F, 0.5f,0.05f, 0,0, "2. Transformari 3D", Functiecallback));
	scene[0].M->AddButton(new buton (0.25F,0.6F, 0.5f,0.05f, 0,0, "3. Proiectia Perspectiva si Paralela", Functiecallback));
	scene[0].M->AddButton(new buton (0.25F,0.5F, 0.5f,0.05f, 0,0, "4. Spatiul Observatorului", Functiecallback));
	scene[0].M->AddButton(new buton (0.25F,0.4F, 0.5f,0.05f, 0,0, "5. Lumina in scena 3D", Functiecallback));
	scene[0].M->AddButton(new buton (0.25F,0.3F, 0.5f,0.05f, 0,0, "6. Efectele de transparenta si ceata", Functiecallback));
	scene[0].M->AddButton(new buton (0.25F,0.2F, 0.5f,0.05f, 0,0, "7. Ce urmeaza la SPG", Functiecallback));
	Text titlu;
	strcpy(titlu.str,"Meniu Principal");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.40;
	titlu.y = 0.9;
	titlu.type = 0;
	scene[0].texte.push_back(titlu);
	scene[0].SetSubHeight(1.05f);
	c = new Camera();
	c->SetPosition(0.0,15.0,0.0);
	c->SetForwardVector(0,-1,0);
	c->SetRightVector(-1,0,0);
	c->SetUpVector(0,0,1);
	scene[0].c = c;
	scene[0].projection = 0;//-1.0F, 1.0F, -1.0F, 1.0F
	scene[0].proj_args[0] = -0.5f;
	scene[0].proj_args[1] = 10.0f;
	scene[0].proj_args[2] = -0.5f;
	scene[0].proj_args[3] = 10.0f;
	initScenariu1();
	initScenariu2();
	initScenariu3();
	initScenariu4();
	initScenariu5();
	initScenariu6();
	initScenariu7();
};

void init()
{
	init_Scenarii();
	scene[current_scene].init();
};

void mainDisplay (void) 
{ 
	scene[current_scene].mainDisplay (); 
}; 

void subDisplay () 
{ 
	scene[current_scene].subDisplay (); 
}; 

void mainReshape (int w, int h) 
{ 
	scene[current_scene].mainReshape(w,h); 
}; 

void subReshape (int w, int h) 
{
	scene[current_scene].subReshape(w,h);
}; 

void keyboard (unsigned char key, int x, int y) 
{ 
	printf("cheia :%c|",key);
	scene[current_scene].keyboard(key,x,y);
	if (current_scene == 5){
		int ix,iRd,iGd,iBd,iRa,iGa,iBa,iRs,iGs,iBs;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Rd") !=0 ; ix++);
		iRd = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Gd") !=0 ; ix++);
		iGd = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Bd") !=0 ; ix++);
		iBd = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Ra") !=0 ; ix++);
		iRa = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Ga") !=0 ; ix++);
		iGa = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Ba") !=0 ; ix++);
		iBa = ix;		
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Rs") !=0 ; ix++);
		iRs = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Gs") !=0 ; ix++);
		iGs = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Bs") !=0 ; ix++);
		iBs = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Light") !=0 ; ix++);
		if (scene[5].selected == 0 )
			sprintf(scene[5].texte[ix].str,"Sus");
		if (scene[5].selected == 1 )
			sprintf(scene[5].texte[ix].str,"Jos");
		if (scene[5].selected == 2 )
			sprintf(scene[5].texte[ix].str,"Stanga");
		if (scene[5].selected == 3 )
			sprintf(scene[5].texte[ix].str,"Dreapta");
		sprintf(scene[5].texte[iRd].str,"%.1f",scene[5].lights[scene[5].selected]->diffuse[0]);
		sprintf(scene[5].texte[iGd].str,"%.1f",scene[5].lights[scene[5].selected]->diffuse[1]);
		sprintf(scene[5].texte[iBd].str,"%.1f",scene[5].lights[scene[5].selected]->diffuse[2]);
		sprintf(scene[5].texte[iRa].str,"%.1f",scene[5].lights[scene[5].selected]->ambient[0]);
		sprintf(scene[5].texte[iGa].str,"%.1f",scene[5].lights[scene[5].selected]->ambient[1]);
		sprintf(scene[5].texte[iBa].str,"%.1f",scene[5].lights[scene[5].selected]->ambient[2]);
		sprintf(scene[5].texte[iRs].str,"%.1f",scene[5].lights[scene[5].selected]->specular[0]);
		sprintf(scene[5].texte[iGs].str,"%.1f",scene[5].lights[scene[5].selected]->specular[1]);
		sprintf(scene[5].texte[iBs].str,"%.1f",scene[5].lights[scene[5].selected]->specular[2]);


	};
	if (current_scene == 6) {

		int ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"Alfa") !=0 ; ix++);
		sprintf(scene[6].texte[ix].str,"%.1f",scene[6].objects3D[scene[6].selected]->culoare[3]);
	};
};

void mainMenu(int value){
	scene[current_scene].mainMenu(value);
};

void subMenu(int value){
	scene[current_scene].subMenu(value);
};

void idle (void) 
{
	glutSetWindow (winIdMain); 
	glutPostRedisplay (); 
	glutSetWindow (winIdSub); 
	glutPostRedisplay (); 
};

void MouseButton(int button,int state,int x, int y)
{
	scene[current_scene].MouseButton(button,state,x,y);
};

void MouseMotion(int x, int y)
{
	scene[current_scene].MouseMotion(x, y);
};

void MousePassiveMotion(int x, int y)
{
	scene[current_scene].MousePassiveMotion(x,y);
};

int main (int argc, char *argv[]) 
{ 

	glutInit (&argc, argv); 
	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

	glutInitWindowPosition (5, 5); 
	glutInitWindowSize (WIDTH, HEIGHT); 

	winIdMain = glutCreateWindow (TITLE); 
	glutDisplayFunc (mainDisplay); 
	glutReshapeFunc (mainReshape); 
	glutKeyboardFunc (keyboard); 
	glutIdleFunc (idle); 

	winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / 10); 
	glutDisplayFunc (subDisplay); 
	glutReshapeFunc (subReshape); 
	glutMouseFunc(MouseButton);
	glutMotionFunc(MouseMotion);
	glutPassiveMotionFunc(MousePassiveMotion);
	init();
	glutMainLoop();

	return 0; 
};

void initScenariu1() {
	delete scene[1].M;
	scene[1].lights.clear();
	scene[1].objects2D.clear();
	scene[1].objects3D.clear();
	scene[1].plans.clear();
	scene[1].texte.clear();
	delete scene[1].c;
	scene[1] = Scenariu();//Transformari 2D
	Text t_but[20];
	int r = 0;
	strcpy(t_but[r].str,"Translatare");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.1;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"X : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Y : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Tx");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Ty");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	buton *b = new buton (0.1F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Tx_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.21F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Tx_mare");
	scene[1].M->AddButton(b);
	b = new buton (0.1F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Ty_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.21F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Ty_mare");
	scene[1].M->AddButton(b);

	strcpy(t_but[r].str,"Scalare");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.3;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"1.0");
	strcpy(t_but[r].comm,"Sx");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"1.0");
	strcpy(t_but[r].comm,"Sy");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	b = new buton (0.3F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Sx_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.41F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Sx_mare");
	scene[1].M->AddButton(b);
	b = new buton (0.3F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Sy_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.41F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Sy_mare");
	scene[1].M->AddButton(b);

	strcpy(t_but[r].str,"Unghi rotatie");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.5;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0");
	strcpy(t_but[r].comm,"R");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	b = new buton (0.5F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("R_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.61F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("R_mare");
	scene[1].M->AddButton(b);
	strcpy(t_but[r].str,"fata de :");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.7;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Px");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.75;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Py");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.75;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[1].texte.push_back(t_but[r++]);
	b = new buton (0.7F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Px_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.81F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Px_mare");
	scene[1].M->AddButton(b);
	b = new buton (0.7F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Py_mic");
	scene[1].M->AddButton(b);
	b = new buton (0.81F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Py_mare");
	scene[1].M->AddButton(b);
	b = new buton (0.67F,0.85F, 0.1f,0.1f, 0,0, "Linie", Functiecallback);
	b->Setcomm("Linie");
	scene[1].M->AddButton(b);
	b = new buton (0.78F,0.85F, 0.1f,0.1f, 0,0, "Triunghi", Functiecallback);
	b->Setcomm("Triunghi");
	scene[1].M->AddButton(b);
	b = new buton (0.89F,0.85F, 0.1f,0.1f, 0,0, "Patrat", Functiecallback);
	b->Setcomm("Patrat");
	scene[1].M->AddButton(b);
	b = new buton (0.84F,0.1F, 0.15f,0.1f, 0,0, "Meniu Principal", Functiecallback);
	b->Setcomm("Meniu");
	scene[1].M->AddButton(b);
	b = new buton (0.1F,0.1F, 0.14f,0.1f, 0,0, "Aplica", Functiecallback);
	b->Setcomm("Translateaza");
	scene[1].M->AddButton(b);
	b = new buton (0.3F,0.1F, 0.14f,0.1f, 0,0, "Aplica", Functiecallback);
	b->Setcomm("Scaleaza");
	scene[1].M->AddButton(b);
	b = new buton (0.5F,0.1F, 0.14f,0.1f, 0,0, "Aplica", Functiecallback);
	b->Setcomm("Roteste");
	scene[1].M->AddButton(b);
	Text titlu;
	strcpy(titlu.str,"1. Transformari 2D");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.35;
	titlu.y = 0.85;
	titlu.type = 0;
	scene[1].texte.push_back(titlu);
	scene[1].c = c;
	scene[1].SetSubHeight(4.0f);
	scene[1].projection = 0;
	scene[1].proj_args[0] = -5.0f;
	scene[1].proj_args[1] = 30.0f;
	scene[1].proj_args[2] = -5.0f;
	scene[1].proj_args[3] = 30.0f;
	Obiect2D  *o = new Obiect2D(Line);
	float x[4], y[4],z[4];
	x[0] = -0.5f;
	y[0] = 0.0f;
	z[0] = 0.0f;
	x[1] = 28.0f;
	y[1] = 0.0f;
	z[1] = 0.0f;
	z[0] = z[1] = z[2] = 0.0f;
	o->SetCuloare(1.0f,1.0f,1.0f);
	o->SetCoords(x,y,z);
	Obiect2D  *o1 = new Obiect2D(Line);
	x[0] = 0.0f;y[0] = -0.5f;x[1] = 0.0f;	y[1] = 20.0f;	o1->SetCuloare(1.0f,1.0f,1.0f);
	o1->SetCoords(x,y,z);
	Obiect2D  *o2 = new Obiect2D(Triangle);
	x[0] = -0.25f;y[0] = 20.0f;x[1] = 0.25f;y[1] = 20.0f;x[2] = 0.0f;y[2] = 20.40f;
	o2->SetCuloare(1.0f,1.0f,1.0f);
	o2->SetCoords(x,y,z);
	Obiect2D  *o3 = new Obiect2D(Triangle);
	x[0] = 28.0f;y[0] = -0.25f;x[1] = 28.0f;y[1] = 0.25f;x[2] = 28.40f;y[2] = 0.0f;
	o3->SetCuloare(1.0f,1.0f,1.0f);
	o3->SetCoords(x,y,z);
	Obiect2D *t[60];
	x[0] = -0.25f;
	y[0] = 1.0f;
	x[1] = 0.25f;
	y[1] = 1.0f;
	Text Text_coord[60];
	int i = 0;
	while (y[0] < 20){
		t[i] = new Obiect2D(Line);
		t[i]->SetCuloare(1.0f,1.0f,1.0f);
		t[i]->SetCoords(x,y,z);
		scene[1].objects2D.push_back(t[i]);
		sprintf(Text_coord[i].str,"%.0f", y[0]);
		Text_coord[i].culoare[0] = 1.0f;
		Text_coord[i].culoare[1] = 1.0f;
		Text_coord[i].culoare[2] = 1.0f;
		Text_coord[i].x = -1.0;
		Text_coord[i].y = y[0]-0.1;
		Text_coord[i].type = 3;
		scene[1].texte.push_back(Text_coord[i++]);
		y[0]++;
		y[1]++;
	}
	x[0] = 1.0f;
	y[0] = -0.25f;
	x[1] = 1.0f;
	y[1] = 0.25f;
	while (x[0] < 28){
		t[i] = new Obiect2D(Line);
		t[i]->SetCuloare(1.0f,1.0f,1.0f);
		t[i]->SetCoords(x,y,z);
		scene[1].objects2D.push_back(t[i]);
		sprintf(Text_coord[i].str,"%.0f", x[0]);
		Text_coord[i].culoare[0] = 1.0f;
		Text_coord[i].culoare[1] = 1.0f;
		Text_coord[i].culoare[2] = 1.0f;
		Text_coord[i].x = x[0]-0.1;
		Text_coord[i].y = -1.0;
		Text_coord[i].type = 3;
		scene[1].texte.push_back(Text_coord[i++]);
		x[0]++;
		x[1]++;
	}
	sprintf(Text_coord[i].str,"X");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = x[0];
	Text_coord[i].y = -1.0;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"Y");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = -1.0;
	Text_coord[i].y = 20.0;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"0");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = -1.0;
	Text_coord[i].y = -1.0;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	Text tex;
	strcpy(tex.str,"(c)Adriana Mihaela Ene - Licenta 2012");
	tex.culoare[0] = 1.0f;
	tex.culoare[1] = 1.0f;
	tex.culoare[2] = 1.0f;
	tex.x = -4.50;
	tex.y = -4.5;
	tex.type = 3;
	scene[1].texte.push_back(tex);
	Obiect2D  *ob = new Obiect2D(Line);
	strcpy(ob->comm,"Obiect");
	x[0] = 3.0f;y[0] = 2.0f;x[1] = 6.0f;	y[1] = 2.0f;x[2] = 6.0f;	y[2] = 6.0f;x[3] = 3.0f;	y[3] = 6.0f;	
	ob->SetCuloare(1.0f,0.0f,0.0f);
	ob->SetCoords(x,y,z);
	ob->SetDrawLines(1);
	scene[1].objects2D.push_back(o);
	scene[1].objects2D.push_back(o1);
	scene[1].objects2D.push_back(o2);
	scene[1].objects2D.push_back(o3);
	scene[1].objects2D.push_back(ob);
	sprintf(Text_coord[i].str,"Coordonate");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = 23.0;
	Text_coord[i].y = 20;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"  X      Y  ");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = 23.0;
	Text_coord[i].y = 19;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"1:    %.1f     %.1f  ",scene[1].objects2D[scene[1].objects2D.size()-1]->coords[0].x,
		scene[1].objects2D[scene[1].objects2D.size()-1]->coords[0].y);
	sprintf(Text_coord[i].comm,"0");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = 22.0;
	Text_coord[i].y = 18;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"2:    %.1f     %.1f  ",scene[1].objects2D[scene[1].objects2D.size()-1]->coords[1].x,
		scene[1].objects2D[scene[1].objects2D.size()-1]->coords[1].y);
	sprintf(Text_coord[i].comm,"1");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = 22.0;
	Text_coord[i].y = 17;
	Text_coord[i].type = 3;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"3:    %.1f     %.1f  ",scene[1].objects2D[scene[1].objects2D.size()-1]->coords[2].x,
		scene[1].objects2D[scene[1].objects2D.size()-1]->coords[2].y);
	sprintf(Text_coord[i].comm,"2");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = 22.0;
	Text_coord[i].y = 16;
	Text_coord[i].type = 3;
	Text_coord[i].Visible = false;
	scene[1].texte.push_back(Text_coord[i++]);
	sprintf(Text_coord[i].str,"4:    %.1f     %.1f  ",scene[1].objects2D[scene[1].objects2D.size()-1]->coords[3].x,
		scene[1].objects2D[scene[1].objects2D.size()-1]->coords[3].y);
	sprintf(Text_coord[i].comm,"3");
	Text_coord[i].culoare[0] = 1.0f;
	Text_coord[i].culoare[1] = 1.0f;
	Text_coord[i].culoare[2] = 1.0f;
	Text_coord[i].x = 22.0;
	Text_coord[i].y = 15;
	Text_coord[i].type = 3;
	Text_coord[i].Visible = false;
	scene[1].texte.push_back(Text_coord[i++]);


};
void initScenariu2(){
	delete scene[2].M;
	scene[2].lights.clear();
	scene[2].objects2D.clear();
	scene[2].objects3D.clear();
	scene[2].plans.clear();
	scene[2].texte.clear();
	delete scene[2].c;
	scene[2] = Scenariu();
	Light *l_omni = new Light();
	l_omni->SetPozitie(0.0,6.0,0.0);
	l_omni->SetDiffuse(1.8f,1.8f,1.8f,1.0f);
	l_omni->SetAmbient(0.5f,0.5f,0.5f,1.0f);
	l_omni->SetSpecular(0.6f,0.6f,0.6f,1.0f);
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l_omni->amb = l_omni->diff = l_omni->spec = true;
	//l_omni->SetDeseneaza(true);
	scene[2].lights.push_back(l_omni);
	scene[2].c = new Camera();
	scene[2].c->SetPosition(0.0,6.0,-30.0);
	scene[2].c->SetForwardVector(0,0,1.0);
	scene[2].c->SetRightVector(1.0,0,0);
	scene[2].c->SetUpVector(0,1.0,0);
	scene[2].SetSubHeight(4.0f);
	scene[3].projection = 1;
	const double DEG2RAD = 3.14159265 / 180;

	double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
	double height = 1 * tangent;          // half height of near plane
	double width = height * (float)WIDTH/HEIGHT;
	scene[2].proj_args[0] = -width;
	scene[2].proj_args[1] = width;
	scene[2].proj_args[2] = -height;
	scene[2].proj_args[3] = height;
	scene[2].proj_args[4] = 1;
	scene[2].proj_args[5] = 60;
	Obiect3D *o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.0,-1.0,0.0);
	o->SetCuloare(0.4,0.0,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect");
	scene[2].objects3D.push_back(o);
	Plan *p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.5f,0.5f,0.6f);
	p->SetTranslat(0.0,-2.0f,0.0);
	scene[2].plans.push_back(p);
	Text t_but[20];
	int r = 0;
	strcpy(t_but[r].str,"Translatare");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.1;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"X : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Y : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Z : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Tx");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Ty");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0.0");
	strcpy(t_but[r].comm,"Tz");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	buton *b = new buton (0.1F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Tx_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.21F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Tx_mare");
	scene[2].M->AddButton(b);
	b = new buton (0.1F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Ty_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.21F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Ty_mare");
	scene[2].M->AddButton(b);
	b = new buton (0.1F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Tz_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.21F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Tz_mare");
	scene[2].M->AddButton(b);
	strcpy(t_but[r].str,"Scalare");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.3;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"1.0");
	strcpy(t_but[r].comm,"Sx");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"1.0");
	strcpy(t_but[r].comm,"Sy");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"1.0");
	strcpy(t_but[r].comm,"Sz");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	b = new buton (0.3F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Sx_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.41F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Sx_mare");
	scene[2].M->AddButton(b);
	b = new buton (0.3F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Sy_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.41F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Sy_mare");
	scene[2].M->AddButton(b);
	b = new buton (0.3F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Sz_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.41F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Sz_mare");
	scene[2].M->AddButton(b);

	strcpy(t_but[r].str,"Unghi rotatie");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.5;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0");
	strcpy(t_but[r].comm,"Rx");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0");
	strcpy(t_but[r].comm,"Ry");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"0");
	strcpy(t_but[r].comm,"Rz");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[2].texte.push_back(t_but[r++]);
	b = new buton (0.5F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Rx_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.61F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Rx_mare");
	scene[2].M->AddButton(b);
	b = new buton (0.5F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Ry_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.61F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Ry_mare");
	scene[2].M->AddButton(b);
	b = new buton (0.5F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Rz_mic");
	scene[2].M->AddButton(b);
	b = new buton (0.61F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Rz_mare");
	scene[2].M->AddButton(b);

	b = new buton (0.67F,0.85F, 0.1f,0.1f, 0,0, "Cub", Functiecallback);
	b->Setcomm("Cub");
	scene[2].M->AddButton(b);
	b = new buton (0.78F,0.85F, 0.1f,0.1f, 0,0, "Sfera", Functiecallback);
	b->Setcomm("Sfera");
	scene[2].M->AddButton(b);
	b = new buton (0.89F,0.85F, 0.1f,0.1f, 0,0, "Con", Functiecallback);
	b->Setcomm("Con");
	scene[2].M->AddButton(b);
	b = new buton (0.75F,0.1F, 0.2f,0.2f, 0,0, "Meniu Principal", Functiecallback);
	b->Setcomm("Meniu");
	scene[2].M->AddButton(b);
	b = new buton (0.75F,0.4F, 0.2f,0.2f, 0,0, "Aplica Transformari", Functiecallback);
	b->Setcomm("Aplica");
	scene[2].M->AddButton(b);
	Text titlu;
	strcpy(titlu.str,"2. Transformari 3D");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.35;
	titlu.y = 0.85;
	titlu.type = 0;
	scene[2].texte.push_back(titlu);

}
void initScenariu3(){
	delete scene[3].M;
	scene[3].lights.clear();
	scene[3].objects2D.clear();
	scene[3].objects3D.clear();
	scene[3].plans.clear();
	scene[3].texte.clear();
	delete scene[3].c;
	scene[3] = Scenariu();
	Light *l_omni = new Light();
	l_omni->SetPozitie(0.0,6.0,0.0);
	l_omni->SetDiffuse(4.0f,4.0f,4.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,0.0f);
	l_omni->SetSpecular(1.0f,1.0f,1.0f,1.0f);
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l_omni->amb = l_omni->diff = l_omni->spec = true;
	l_omni->SetDeseneaza(true);
	scene[3].lights.push_back(l_omni);

	scene[3].c = new Camera();
	scene[3].c->SetPosition(0.0,6.0,-30.0);
	scene[3].c->SetForwardVector(0,0,1.0);
	scene[3].c->SetRightVector(1.0,0,0);
	scene[3].c->SetUpVector(0,1.0,0);


	scene[3].SetSubHeight(4.0f);
	scene[3].projection = 1;
	const double DEG2RAD = 3.14159265 / 180;
	double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
	double height = 1 * tangent;          // half height of near plane
	double width = height * (float)WIDTH/HEIGHT;
	scene[3].proj_args[0] = -width;
	scene[3].proj_args[1] = width;
	scene[3].proj_args[2] = -height;
	scene[3].proj_args[3] = height;
	scene[3].proj_args[4] = 1;
	scene[3].proj_args[5] = 60;
	Obiect3D *o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.0,-1.0,0.0);
	o->SetCuloare(0.4,0.0,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Cub");
	scene[3].objects3D.push_back(o);
	o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(2.0,-1.0,1.0);
	o->SetLevelOfDetail(20);
	o->SetCuloare(0.6,0.2,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Sfera");
	scene[3].objects3D.push_back(o);
	o = new Obiect3D(Cone,Solid);
	o->SetTranslat(-2.0,-2.0,1.0);
	o->SetLevelOfDetail(20);
	o->SetCuloare(0.0,0.2,0.0);
	o->SetScalare(1.5,1.5,1.5);
	o->SetRotatie(-90,0.0,0.0);
	strcpy(o->comm,"Con");
	scene[3].objects3D.push_back(o);
	o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.5,0.0,0.0);
	o->SetCuloare(0.0,0.0,0.7);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Cub2");
	scene[3].objects3D.push_back(o);
	o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(5.0,0.0,0.0);
	o->SetLevelOfDetail(10.0f);
	o->SetCuloare(0.7,0.7,0.7);
	o->SetScalare(0.2,0.2,0.2);
	strcpy(o->comm,"Obs");
	scene[3].objects3D.push_back(o);
	o = new Obiect3D(Pyramid,Wire);
	o->SetTranslat(5.0,0.0,0.0);// coordonate obs
	o->SetLevelOfDetail(10.0f);
	o->SetCuloare(0.7,0.7,0.7);
	o->SetRotatie(0,-90,0);
	/*
	glVertex3f(  0.0f,  0.0f, 0.0f);
	glVertex3f(-1.0f, -1.0f, 1.0f);
	glVertex3f( 1.0f, -1.0f, 1.0f);
	glVertex3f( 1.0f, -1.0f, -1.0f);
	glVertex3f( -1.0f, -1.0f, -1.0f);
	glVertex3f(-1.0f, -1.0f, 1.0f);
	*/
	float l ,ri, n ,t , bo ,f;
	l = -0.5;
	ri  = 0.5;
	n = 1;
	f = 10;
	t = 0.5;
	bo = -0.5;
	scene[3].custom_cam = new Camera();
	scene[3].custom_cam->SetPosition(5.0,0.0,0.0);
	scene[3].custom_cam->SetForwardVector(-n,0,0.0);
	scene[3].custom_cam->SetRightVector(ri,0,0);
	scene[3].custom_cam->SetUpVector(0,t,0);
	//scene[3].use_custom = true;
	//scene[3].custom_orto = true;
	if (scene[3].use_custom) {
		scene[3].proj_args[0] = l;
		scene[3].proj_args[1] = ri;
		scene[3].proj_args[2] = bo;
		scene[3].proj_args[3] = t;
		scene[3].proj_args[4] = n;
		scene[3].proj_args[5] = f;
	}
	float coor_x[8],coor_y[8],coor_z[8];
	coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
	coor_x[1] = l; coor_y[1]=t ; coor_z[1] = n;
	coor_x[2] = ri; coor_y[2]= t;coor_z[2] = n;
	coor_x[3] = ri;coor_y[3]= bo;coor_z[3] = n;
	coor_x[4] = l;coor_y[4]= bo;coor_z[4] = n;
	o->SetCoords(coor_x,coor_y,coor_z);
	strcpy(o->comm,"Near");
	scene[3].objects3D.push_back(o);
	o = new Obiect3D(Pyramid,Wire);
	o->SetTranslat(5.0,0.0,0.0);// coordonate obs
	o->SetLevelOfDetail(10.0f);
	o->SetCuloare(0.7,0.7,0.7);
	o->SetRotatie(0,-90,0);
	/*
	glVertex3f(  0.0f,  0.0f, 0.0f);
	glVertex3f(-1.0f, -1.0f, 1.0f);
	glVertex3f( 1.0f, -1.0f, 1.0f);
	glVertex3f( 1.0f, -1.0f, -1.0f);
	glVertex3f( -1.0f, -1.0f, -1.0f);
	glVertex3f(-1.0f, -1.0f, 1.0f);
	*/


	//float coor_x[5],coor_y[5],coor_z[5];
	coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
	coor_x[1] = (float)l * ((float)f/n); coor_y[1] = t * ((float)f/n) ; coor_z[1] = f;
	coor_x[2] = ri * ((float)f/n); coor_y[2]= t * ((float)f/n);coor_z[2] = f;
	coor_x[3] = ri * ((float)f/n);coor_y[3]= bo * ((float)f/n);coor_z[3] = f;
	coor_x[4] = l * ((float)f/n);coor_y[4]= bo * ((float)f/n);coor_z[4] = f;
	o->SetCoords(coor_x,coor_y,coor_z);
	strcpy(o->comm,"Far");
	scene[3].objects3D.push_back(o);
	Plan *p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.5f,0.5f,0.6f);
	p->SetTranslat(0.0,-2.0f,0.0);
	scene[3].plans.push_back(p);
	Text t_but[20];
	int r = 0;
	strcpy(t_but[r].str,"Sus:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.6;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Jos:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Dreapta:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.4;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Stanga:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Aproape:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.2;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Departe:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",t);
	strcpy(t_but[r].comm,"Sus");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.25;
	t_but[r].y = 0.6;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",bo);
	strcpy(t_but[r].comm,"Jos");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.25;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	buton *b = new buton (0.2F,0.6F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Sus_mic");
	scene[3].M->AddButton(b);
	b = new buton (0.35F,0.6F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Sus_mare");
	scene[3].M->AddButton(b);
	b = new buton (0.2F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Jos_mic");
	scene[3].M->AddButton(b);
	b = new buton (0.35F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Jos_mare");
	scene[3].M->AddButton(b);

	sprintf(t_but[r].str,"%.1f",ri);
	strcpy(t_but[r].comm,"Dreapta");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.25;
	t_but[r].y = 0.4;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",l);
	strcpy(t_but[r].comm,"Stanga");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.25;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Proiectie selectata:");
	strcpy(t_but[r].comm,"proiec");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.75;
	t_but[r].y = 0.6;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Perspectiva");
	strcpy(t_but[r].comm,"Proiectie");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.75;
	t_but[r].y = 0.4;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	b = new buton (0.2F,0.4F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Dreapta_mic");
	scene[3].M->AddButton(b);
	b = new buton (0.35F,0.4F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Dreapta_mare");
	scene[3].M->AddButton(b);
	b = new buton (0.2F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Stanga_mic");
	scene[3].M->AddButton(b);
	b = new buton (0.35F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Stanga_mare");
	scene[3].M->AddButton(b);

	sprintf(t_but[r].str,"%.1f",n);
	strcpy(t_but[r].comm,"Aproape");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.25;
	t_but[r].y = 0.2;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",f);
	strcpy(t_but[r].comm,"Departe");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.25;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[3].texte.push_back(t_but[r++]);
	b = new buton (0.2F,0.2F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Aproape_mic");
	scene[3].M->AddButton(b);
	b = new buton (0.35F,0.2F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Aproape_mare");
	scene[3].M->AddButton(b);
	b = new buton (0.2F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Departe_mic");
	scene[3].M->AddButton(b);
	b = new buton (0.35F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Departe_mare");
	scene[3].M->AddButton(b);

	b = new buton (0.67F,0.85F, 0.15f,0.1f, 0,0, "Perspectiva", Functiecallback);
	b->Setcomm("Perspectiva");
	scene[3].M->AddButton(b);
	b = new buton (0.83F,0.85F, 0.15f,0.1f, 0,0, "Ortografica", Functiecallback);
	b->Setcomm("Ortografica");
	scene[3].M->AddButton(b);
	b = new buton (0.75F,0.1F, 0.2f,0.2f, 0,0, "Meniu Principal", Functiecallback);
	b->Setcomm("Meniu");
	scene[3].M->AddButton(b);
	b = new buton (0.45F,0.1F, 0.2f,0.2f, 0,0, "Vezi scena", Functiecallback);
	b->Setcomm("Scena");
	scene[3].M->AddButton(b);
	b = new buton (0.45F,0.5F, 0.2f,0.2f, 0,0, "Ce vede observatorul?", Functiecallback);
	b->Setcomm("Vezi");
	scene[3].M->AddButton(b);
	Text titlu;
	strcpy(titlu.str,"2. Proiectia Perspectiva si Paralela");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.15;
	titlu.y = 0.85;
	titlu.type = 0;
	scene[3].texte.push_back(titlu);
};
void initScenariu4()
{
	delete scene[4].M;
	scene[4].lights.clear();
	scene[4].objects2D.clear();
	scene[4].objects3D.clear();
	scene[4].plans.clear();
	scene[4].texte.clear();
	delete scene[4].c;
	scene[4] = Scenariu();
	Light *l_omni = new Light();
	l_omni->SetPozitie(0.0,6.0,0.0);
	l_omni->SetDiffuse(4.0f,4.0f,4.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,0.0f);
	l_omni->SetSpecular(1.0f,1.0f,1.0f,1.0f);
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l_omni->amb = l_omni->diff = l_omni->spec = true;
	l_omni->SetDeseneaza(true);
	scene[4].lights.push_back(l_omni);

	scene[4].c = new Camera();
	scene[4].c->SetPosition(0.0,6.0,-30.0);
	scene[4].c->SetForwardVector(0,0,1.0);
	scene[4].c->SetRightVector(1.0,0,0);
	scene[4].c->SetUpVector(0,1.0,0);

	scene[4].custom_cam = new Camera();
	scene[4].custom_cam->SetPosition(5.0,0.0,0.0);
	scene[4].custom_cam->SetForwardVector(-1.0,0,0.0);
	scene[4].custom_cam->SetRightVector(1.0,0,0);
	scene[4].custom_cam->SetUpVector(0,1.0,0);
	//scene[3].use_custom = true;
	scene[4].SetSubHeight(4.0f);
	scene[4].projection = 1;
	const double DEG2RAD = 3.14159265 / 180;
	double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
	double height = 1 * tangent;          // half height of near plane
	double width = height * (float)WIDTH/HEIGHT;
	scene[4].proj_args[0] = -width;
	scene[4].proj_args[1] = width;
	scene[4].proj_args[2] = -height;
	scene[4].proj_args[3] = height;
	scene[4].proj_args[4] = 1;
	scene[4].proj_args[5] = 60;
	Obiect3D *o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.0,-1.0,0.0);
	o->SetCuloare(0.4,0.0,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect1");
	scene[4].objects3D.push_back(o);
	o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(2.0,-1.0,1.0);
	o->SetLevelOfDetail(20);
	o->SetCuloare(0.6,0.2,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect2");
	scene[4].objects3D.push_back(o);
	o = new Obiect3D(Cone,Solid);
	o->SetTranslat(-2.0,-2.0,1.0);
	o->SetLevelOfDetail(20);
	o->SetCuloare(0.0,0.2,0.0);
	o->SetScalare(1.5,1.5,1.5);
	o->SetRotatie(-90,0.0,0.0);
	strcpy(o->comm,"Obiect3");
	scene[4].objects3D.push_back(o);
	o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.5,0.0,0.0);
	o->SetCuloare(0.0,0.0,0.7);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect3");
	scene[4].objects3D.push_back(o);
	o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(5.0,0.0,0.0);
	o->SetLevelOfDetail(10.0f);
	o->SetCuloare(0.7,0.7,0.7);
	o->SetScalare(0.2,0.2,0.2);
	strcpy(o->comm,"Observ");
	scene[4].objects3D.push_back(o);
	Plan *p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.5f,0.5f,0.6f);
	p->SetTranslat(0.0,-2.0f,0.0);
	scene[4].plans.push_back(p);
	o = new Obiect3D(Linie,Wire);
	o->SetTranslat(5.0,0.0,0.0);
	o->SetCuloare(0.0,0.0,0.6);
	float coor_x[8],coor_y[8],coor_z[8];
	coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
	coor_x[1] = scene[4].custom_cam->ForwardVector[0]; coor_y[1]=scene[4].custom_cam->ForwardVector[1]; coor_z[1] = scene[4].custom_cam->ForwardVector[2];
	o->SetCoords(coor_x,coor_y,coor_z);
	strcpy(o->comm,"Forwardv");
	scene[4].objects3D.push_back(o);
	o = new Obiect3D(Linie,Wire);
	o->SetTranslat(5.0,0.0,0.0);
	o->SetCuloare(0.6,0.0,0.0);
	coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
	coor_x[1] = scene[4].custom_cam->UpVector[0]; coor_y[1]=scene[4].custom_cam->UpVector[1]; coor_z[1] = scene[4].custom_cam->UpVector[2];
	o->SetCoords(coor_x,coor_y,coor_z);
	strcpy(o->comm,"Upv");
	scene[4].objects3D.push_back(o);


	Text t_but[20];
	int r = 0;
	strcpy(t_but[r].str,"Inainte");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.1;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"X : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Y : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Z : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->ForwardVector[0]);
	strcpy(t_but[r].comm,"Inaintex");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->ForwardVector[1]);
	strcpy(t_but[r].comm,"Inaintey");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->ForwardVector[2]);
	strcpy(t_but[r].comm,"Inaintez");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.15;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	buton *b = new buton (0.1F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Inaintex_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.21F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Inaintex_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.1F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Inaintey_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.21F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Inaintey_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.1F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Inaintez_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.21F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Inaintez_mare");
	scene[4].M->AddButton(b);
	strcpy(t_but[r].str,"Sus");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.3;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->UpVector[0]);
	strcpy(t_but[r].comm,"Susx");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->UpVector[1]);
	strcpy(t_but[r].comm,"Susy");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->UpVector[2]);
	strcpy(t_but[r].comm,"Susz");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.35;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	b = new buton (0.3F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Susx_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.41F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Susx_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.3F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Susy_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.41F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Susy_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.3F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Susz_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.41F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Susz_mare");
	scene[4].M->AddButton(b);

	strcpy(t_but[r].str,"Pozitie");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.5;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->Position[0]);
	strcpy(t_but[r].comm,"Pozitiex");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->Position[1]);
	strcpy(t_but[r].comm,"Pozitiey");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[4].custom_cam->Position[2]);
	strcpy(t_but[r].comm,"Pozitiez");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[4].texte.push_back(t_but[r++]);
	b = new buton (0.5F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Pozitiex_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.61F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Pozitiex_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.5F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Pozitiey_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.61F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Pozitiey_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.5F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Pozitiez_mic");
	scene[4].M->AddButton(b);
	b = new buton (0.61F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Pozitiez_mare");
	scene[4].M->AddButton(b);
	b = new buton (0.75F,0.1F, 0.2f,0.15f, 0,0, "Meniu Principal", Functiecallback);
	b->Setcomm("Meniu");
	scene[4].M->AddButton(b);
	b = new buton (0.75F,0.3F, 0.2f,0.15f, 0,0, "Cum vede observatorul?", Functiecallback);
	b->Setcomm("Vezi");
	scene[4].M->AddButton(b);
	b = new buton (0.75F,0.5F, 0.2f,0.15f, 0,0, "Vezi Scena", Functiecallback);
	b->Setcomm("Scena");
	scene[4].M->AddButton(b);
	Text titlu;
	strcpy(titlu.str,"4. Spatiul Observatorului");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.35;
	titlu.y = 0.85;
	titlu.type = 0;
	scene[4].texte.push_back(titlu);
};
void initScenariu5()
{
	delete scene[5].M;
	scene[5].lights.clear();
	scene[5].objects2D.clear();
	scene[5].objects3D.clear();
	scene[5].plans.clear();
	scene[5].texte.clear();
	delete scene[5].c;
	scene[5] = Scenariu();
	Light::baseId = 0;

	Light *l_omni = new Light();
	l_omni->SetPozitie(0.0,8.0,0.0);
	l_omni->SetDiffuse(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetSpecular(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	Obiect3D *l = new Obiect3D(Sphere,Solid);
	l->SetTranslat(0.0,8.0,0.0);
	l->SetCuloare(0.2,0.2,0.2);
	l->SetScalare(0.3,0.3,0.3);
	l->SetLevelOfDetail(30);
	l->select();
	strcpy(l->comm,"Light_sus");
	scene[5].objects3D.push_back(l);
	scene[5].lights.push_back(l_omni);
	l_omni = new Light();
	l_omni->SetPozitie(0.0,2.0,0.0);
	l_omni->SetDiffuse(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetSpecular(0.0f,0.0f,0.0f,1.0f);//l_omni->amb = true;l_omni->diff = true;l_omni->spec = true;
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l = new Obiect3D(Sphere,Solid);
	l->SetTranslat(0.0,2.0,0.0);
	l->SetCuloare(0.2,0.2,0.2);
	l->SetScalare(0.3,0.3,0.3);
	l->SetLevelOfDetail(30);
	strcpy(l->comm,"Light_jos");
	scene[5].objects3D.push_back(l);
	scene[5].lights.push_back(l_omni);
	l_omni = new Light();
	l_omni->SetPozitie(3.0,5.0,0.0);
	l_omni->SetDiffuse(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetSpecular(0.0f,0.0f,0.0f,1.0f);//l_omni->amb = true;l_omni->diff = true;l_omni->spec = true;
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l = new Obiect3D(Sphere,Solid);
	l->SetTranslat(3.0,5.0,0.0);
	l->SetCuloare(0.2,0.2,0.2);
	l->SetScalare(0.3,0.3,0.3);
	l->SetLevelOfDetail(30);
	strcpy(l->comm,"Light_stanga");
	scene[5].objects3D.push_back(l);
	scene[5].lights.push_back(l_omni);
	l_omni = new Light();
	l_omni->SetPozitie(-3.0,5.0,0.0);
	l_omni->SetDiffuse(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,1.0f);
	l_omni->SetSpecular(0.0f,0.0f,0.0f,1.0f);//l_omni->amb = true;l_omni->diff = true;l_omni->spec = true;
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l = new Obiect3D(Sphere,Solid);
	l->SetTranslat(-3.0,5.0,0.0);
	l->SetCuloare(0.2,0.2,0.2);
	l->SetScalare(0.3,0.3,0.3);
	l->SetLevelOfDetail(30);
	strcpy(l->comm,"Light_dreapta");
	scene[5].objects3D.push_back(l);
	scene[5].lights.push_back(l_omni);
	scene[5].c = new Camera();
	scene[5].c->SetPosition(0.0,6.0,-30.0);
	scene[5].c->SetForwardVector(0,0,1.0);
	scene[5].c->SetRightVector(1.0,0,0);
	scene[5].c->SetUpVector(0,1.0,0);
	scene[5].SetSubHeight(4.0f);
	scene[5].projection = 1;
	const double DEG2RAD = 3.14159265 / 180;
	double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
	double height = 1 * tangent;          // half height of near plane
	double width = height * (float)WIDTH/HEIGHT;
	scene[5].proj_args[0] = -width;
	scene[5].proj_args[1] = width;
	scene[5].proj_args[2] = -height;
	scene[5].proj_args[3] = height;
	scene[5].proj_args[4] = 1;
	scene[5].proj_args[5] = 60;
	Obiect3D *o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(0,5.0,0.0);
	o->SetLevelOfDetail(100);
	o->SetCuloare(1.0,0.0,0.0);
	o->SetScalare(1.2,1.2,1.2);
	o->selectable = false;

	strcpy(o->comm,"Obiect2");
	scene[5].objects3D.push_back(o);
	Plan *p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.5f,0.5f,0.6f);
	p->SetTranslat(0.0,-2.0f,0.0);
	scene[5].plans.push_back(p);
	p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.0f,0.5f,0.0f);
	p->SetTranslat(0.0,5.0f,6.0);
	p->SetRotatie(-90,0,0);
	scene[5].plans.push_back(p);
	p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.0f,0.5f,0.6f);
	p->SetTranslat(6.0,5.0f,0.0);
	p->SetRotatie(0,0,90);
	scene[5].plans.push_back(p);
	p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.0f,0.5f,0.6f);
	p->SetTranslat(-7.0,4.0f,0.0);
	p->SetRotatie(0,0,-90);
	scene[5].plans.push_back(p);

	Text t_but[20];
	int r = 0;
	strcpy(t_but[r].str,"Difuza");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.1;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"R : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.02;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"G : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.02;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	scene[5].selected = 0;
	strcpy(t_but[r].str,"B : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.02;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->diffuse[0]);
	strcpy(t_but[r].comm,"Rd");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.11;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->diffuse[1]);
	strcpy(t_but[r].comm,"Gd");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.11;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->diffuse[2]);
	strcpy(t_but[r].comm,"Bd");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.11;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	buton *b = new buton (0.06F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Rd_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.17F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Rd_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.06F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Gd_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.17F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Gd_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.06F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Bd_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.17F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Bd_mare");
	scene[5].M->AddButton(b);

	strcpy(t_but[r].str,"Ambientala");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.23;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->ambient[0]);
	strcpy(t_but[r].comm,"Ra");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.28;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->ambient[1]);
	strcpy(t_but[r].comm,"Ga");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.28;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->ambient[2]);
	strcpy(t_but[r].comm,"Ba");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.28;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	b = new buton (0.23F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Ra_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.34F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Ra_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.23F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Ga_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.34F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Ga_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.23F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Ba_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.34F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Ba_mare");
	scene[5].M->AddButton(b);

	strcpy(t_but[r].str,"Speculara");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.40;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->specular[0]);
	strcpy(t_but[r].comm,"Rs");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.45;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->specular[1]);
	strcpy(t_but[r].comm,"Gs");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.45;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[5].lights[0]->specular[2]);
	strcpy(t_but[r].comm,"Bs");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.45;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	b = new buton (0.4F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Rs_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.51F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Rs_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.4F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Gs_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.51F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Gs_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.4F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Bs_mic");
	scene[5].M->AddButton(b);
	b = new buton (0.51F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Bs_mare");
	scene[5].M->AddButton(b);
	b = new buton (0.75F,0.1F, 0.2f,0.15f, 0,0, "Meniu Principal", Functiecallback);
	b->Setcomm("Meniu");
	scene[5].M->AddButton(b);
	b = new buton (0.57F,0.5F, 0.15f,0.15f, 0,0, "Reset Difuza", Functiecallback);
	b->Setcomm("ResetD");
	scene[5].M->AddButton(b);
	b = new buton (0.57F,0.3F, 0.15f,0.15f, 0,0, "Reset Ambientala", Functiecallback);
	b->Setcomm("ResetA");
	scene[5].M->AddButton(b);
	b = new buton (0.57F,0.1F, 0.15f,0.15f, 0,0, "Reset Speculara", Functiecallback);
	b->Setcomm("ResetS");
	scene[5].M->AddButton(b);
	strcpy(t_but[r].str,"Lumina Selectata:");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.75;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"Sus");
	strcpy(t_but[r].comm,"Light");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.8;
	t_but[r].y = 0.35;
	t_but[r].type = 4;
	scene[5].texte.push_back(t_but[r++]);
	Text titlu;
	strcpy(titlu.str,"5. Lumina in scena 3D");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.35;
	titlu.y = 0.85;
	titlu.type = 0;
	scene[5].texte.push_back(titlu);

};
void initScenariu6(){
	delete scene[6].M;
	scene[6].lights.clear();
	scene[6].objects2D.clear();
	scene[6].objects3D.clear();
	scene[6].plans.clear();
	scene[6].texte.clear();
	scene[6] = Scenariu();
	Light *l_omni = new Light();
	l_omni->SetPozitie(0.0,6.0,0.0);
	l_omni->SetDiffuse(4.0f,4.0f,4.0f,1.0f);
	l_omni->SetAmbient(0.0f,0.0f,0.0f,0.0f);
	l_omni->SetSpecular(1.0f,1.0f,1.0f,1.0f);
	l_omni->SetCuloare(1.0f,1.0f,1.0f);
	l_omni->SetScalare(0.2,0.2,0.2);
	l_omni->amb = l_omni->diff = l_omni->spec = true;
	l_omni->SetDeseneaza(true);
	scene[6].lights.push_back(l_omni);
	scene[6].c = new Camera();
	scene[6].c->SetPosition(0.0,6.0,-30.0);
	scene[6].c->SetForwardVector(0,0,1.0);
	scene[6].c->SetRightVector(1.0,0,0);
	scene[6].c->SetUpVector(0,1.0,0);
	scene[6].custom_cam = new Camera();
	scene[6].custom_cam->SetPosition(5.0,0.0,0.0);
	scene[6].custom_cam->SetForwardVector(-1.0,0,0.0);
	scene[6].custom_cam->SetRightVector(1.0,0,0);
	scene[6].custom_cam->SetUpVector(0,1.0,0);
	//scene[3].use_custom = true;
	scene[6].SetSubHeight(4.0f);
	scene[6].projection = 1;
	const double DEG2RAD = 3.14159265 / 180;
	double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
	double height = 1 * tangent;          // half height of near plane
	double width = height * (float)WIDTH/HEIGHT;
	scene[6].proj_args[0] = -width;
	scene[6].proj_args[1] = width;
	scene[6].proj_args[2] = -height;
	scene[6].proj_args[3] = height;
	scene[6].proj_args[4] = 1;
	scene[6].proj_args[5] = 60;
	Obiect3D *o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.0,-1.0,0.0);
	o->SetCuloare(0.4,0.0,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect1");
	scene[6].objects3D.push_back(o);
	o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(2.0,-1.0,1.0);
	o->SetLevelOfDetail(20);
	o->SetCuloare(0.6,0.2,0.0);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect2");
	scene[6].objects3D.push_back(o);
	o = new Obiect3D(Cone,Solid);
	o->SetTranslat(-2.0,-2.0,1.0);
	o->SetLevelOfDetail(20);
	o->SetCuloare(0.0,0.2,0.0);
	o->SetScalare(1.5,1.5,1.5);
	o->SetRotatie(-90,0.0,0.0);
	strcpy(o->comm,"Obiect3");
	scene[6].objects3D.push_back(o);
	o = new Obiect3D(Cube,Solid);
	o->SetTranslat(0.5,0.0,0.0);
	o->SetCuloare(0.0,0.0,0.7);
	o->SetScalare(1.0,1.0,1.0);
	strcpy(o->comm,"Obiect3");
	scene[6].objects3D.push_back(o);
	o = new Obiect3D(Sphere,Solid);
	o->SetTranslat(5.0,0.0,0.0);
	o->SetLevelOfDetail(10.0f);
	o->SetCuloare(0.7,0.7,0.7);
	o->SetScalare(0.2,0.2,0.2);
	strcpy(o->comm,"Obiect3");
	o->selectable = false;
	scene[6].objects3D.push_back(o);
	Plan *p = new Plan(SolidPlan,7.0f);
	p->SetLevelOfDetail(10.0f);
	p->SetCuloare(0.5f,0.5f,0.6f);
	p->SetTranslat(0.0,-2.0f,0.0);
	scene[6].plans.push_back(p);
	scene[6].use_fog = true;
	scene[6].ceata.culoare[0] = 0.5;
	scene[6].ceata.culoare[1] = 0.5;
	scene[6].ceata.culoare[2] = 0.5;
	scene[6].ceata.culoare[3] = 0.1;
	scene[6].ceata.type = LINIAR;
	scene[6].ceata.nearl = 10.0f;
	scene[6].ceata.farl = 100.0f;
	scene[6].ceata.dens = 0.02f;
	Text t_but[20];
	int r = 0;
	strcpy(t_but[r].str,"Culoare Ceata");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.03;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"R : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.02;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	strcpy(t_but[r].str,"G : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.02;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	scene[6].selected = 0;
	strcpy(t_but[r].str,"B : ");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.02;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[6].ceata.culoare[0]);
	strcpy(t_but[r].comm,"R");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.11;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[6].ceata.culoare[1]);
	strcpy(t_but[r].comm,"G");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.11;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f",scene[6].ceata.culoare[2]);
	strcpy(t_but[r].comm,"B");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.11;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	buton *b = new buton (0.06F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("R_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.17F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("R_mare");
	scene[6].M->AddButton(b);
	b = new buton (0.06F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("G_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.17F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("G_mare");
	scene[6].M->AddButton(b);
	b = new buton (0.06F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("B_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.17F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("B_mare");
	scene[6].M->AddButton(b);
	sprintf(t_but[r].str,"Tip  :");
	strcpy(t_but[r].comm,"");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.22;
	t_but[r].y = 0.7;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"Aproape  :");
	strcpy(t_but[r].comm,"");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.22;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"Departe   :");
	strcpy(t_but[r].comm,"");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.22;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"Densitate:");
	strcpy(t_but[r].comm,"");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.22;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"Linear");
	strcpy(t_but[r].comm,"Tip");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.40;
	t_but[r].y = 0.7;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f", scene[6].ceata.nearl);
	strcpy(t_but[r].comm,"Aproape");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.40;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f", scene[6].ceata.farl);
	strcpy(t_but[r].comm,"Departe");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.40;
	t_but[r].y = 0.3;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.2f", scene[6].ceata.dens);
	strcpy(t_but[r].comm,"Densitate");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.40;
	t_but[r].y = 0.1;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	b = new buton (0.36F,0.7F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Tip_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.475F,0.7F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Tip_mare");
	scene[6].M->AddButton(b);
	b = new buton (0.36F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Aproape_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.47F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Aproape_mare");
	scene[6].M->AddButton(b);
	b = new buton (0.36F,0.3F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Departe_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.47F,0.3F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Departe_mare");
	scene[6].M->AddButton(b);
	b = new buton (0.36F,0.1F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Densitate_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.47F,0.1F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Densitate_mare");
	scene[6].M->AddButton(b);

	strcpy(t_but[r].str,"Transparenta obiect");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.53;
	t_but[r].y = 0.67;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"Alfa");
	strcpy(t_but[r].comm,"");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.55;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	sprintf(t_but[r].str,"%.1f", scene[6].objects3D[scene[6].selected]->culoare[3]);
	strcpy(t_but[r].comm,"Alfa");
	t_but[r].culoare[0] = 0.1f;
	t_but[r].culoare[1] = 0.1f;
	t_but[r].culoare[2] = 0.1f;
	t_but[r].x = 0.67;
	t_but[r].y = 0.5;
	t_but[r].type = 4;
	scene[6].texte.push_back(t_but[r++]);
	b = new buton (0.62F,0.5F, 0.03f,0.08f, 0,0, "<", Functiecallback);
	b->Setcomm("Alfa_mic");
	scene[6].M->AddButton(b);
	b = new buton (0.73F,0.5F, 0.03f,0.08f, 0,0, ">", Functiecallback);
	b->Setcomm("Alfa_mare");
	scene[6].M->AddButton(b);
	b = new buton (0.78F,0.3F, 0.2f,0.13f, 0,0, "Meniu Principal", Functiecallback);
	b->Setcomm("Meniu");
	scene[6].M->AddButton(b);
	b = new buton (0.55F,0.3F, 0.21f,0.13f, 0,0, "Vezi scena", Functiecallback);
	b->Setcomm("Scena");
	scene[6].M->AddButton(b);
	b = new buton (0.55F,0.1F, 0.21f,0.13f, 0,0, "Schimba observatorul", Functiecallback);
	b->Setcomm("Obs");
	scene[6].M->AddButton(b);
	Text titlu;
	strcpy(titlu.str,"6. Efectele de transparenta si ceata");
	titlu.culoare[0] = 0.1f;
	titlu.culoare[1] = 0.1f;
	titlu.culoare[2] = 0.1f;
	titlu.x = 0.25;
	titlu.y = 0.85;
	titlu.type = 0;
	scene[6].texte.push_back(titlu);
};
void initScenariu7() {
};
void process_button_and_make_changes(){
	if (current_scene == 0){
		if (strcmp(lastbutton, "1. Transformari 2D") == 0)
			current_scene = 1;
		if (strcmp(lastbutton, "2. Transformari 3D") == 0)
			current_scene = 2;
		if (strcmp(lastbutton, "3. Proiectia Perspectiva si Paralela") == 0)
			current_scene = 3;
		if (strcmp(lastbutton, "4. Spatiul Observatorului") == 0)
			current_scene = 4;
		if (strcmp(lastbutton, "5. Lumina in scena 3D") == 0)
			current_scene = 5;
		if (strcmp(lastbutton, "6. Efectele de transparenta si ceata") == 0)
			current_scene = 6;
		if (strcmp(lastbutton, "7. Ce urmeaza la SPG") == 0)
			current_scene = 7;
		glutDestroyWindow(winIdSub);
		glutDestroyWindow(winIdMain);
		winIdMain = glutCreateWindow (TITLE); 
		glutDisplayFunc (mainDisplay); 
		glutReshapeFunc (mainReshape); 
		glutKeyboardFunc (keyboard); 
		glutIdleFunc (idle);

		winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
		glutDisplayFunc (subDisplay); 
		glutReshapeFunc (subReshape); 
		glutMouseFunc(MouseButton);
		glutMotionFunc(MouseMotion);
		glutPassiveMotionFunc(MousePassiveMotion);
		if (current_scene == 1 || current_scene == 3){
			HWND win=FindWindowA(NULL,TITLE);
			unsigned int style=GetWindowLong(win,GWL_STYLE);//Get the current style
			style&=~WS_MAXIMIZEBOX;//Disable the maximize box
			SetWindowLong(win,GWL_STYLE,style);
		};
	};
	if (current_scene == 1) 
	{
		if (strcmp(lastbutton , "Tx_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Tx") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Tx_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Tx") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Ty_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Ty") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Ty_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Ty") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)+0.5f);
		};

		if (strcmp(lastbutton , "Sx_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Sx") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Sx_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Sx") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Sy_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Sy") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Sy_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Sy") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)+0.5f);
		};

		if (strcmp(lastbutton , "R_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"R") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%d",(atoi(scene[1].texte[i].str)-5)%360);
		};
		if (strcmp(lastbutton , "R_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"R") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%d",(atoi(scene[1].texte[i].str)+5)%360);
		};
		if (strcmp(lastbutton , "Px_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Px") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Px_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Px") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Py_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Py") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Py_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[1].texte.size() && strcmp(scene[1].texte[i].comm,"Py") !=0 ; i++);
			sprintf(scene[1].texte[i].str,"%.1f",atof(scene[1].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Translateaza") == 0) {
			int ix,iy,i,k;
			float xt,yt;
			for (ix = 0 ; ix < scene[1].texte.size() && strcmp(scene[1].texte[ix].comm,"Tx") !=0 ; ix++);
			xt = atof(scene[1].texte[ix].str);
			for (iy = 0 ; iy < scene[1].texte.size() && strcmp(scene[1].texte[iy].comm,"Ty") !=0 ; iy++);
			yt = atof(scene[1].texte[iy].str);
			for (i = 0 ; i < scene[1].objects2D.size() && strcmp(scene[1].objects2D[i]->comm,"Obiect") !=0 ; i++);
			scene[1].objects2D[i]->coords[0].x += xt;
			scene[1].objects2D[i]->coords[0].y += yt;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"0") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"1:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[0].x,
				scene[1].objects2D[i]->coords[0].y);
			scene[1].objects2D[i]->coords[1].x += xt;
			scene[1].objects2D[i]->coords[1].y += yt;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"1") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"2:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[1].x,
				scene[1].objects2D[i]->coords[1].y);
			if (scene[1].objects2D[i]->tip != Line){
				scene[1].objects2D[i]->coords[2].x += xt;
				scene[1].objects2D[i]->coords[2].y += yt;
				for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"2") !=0 ; k++);
				sprintf(scene[1].texte[k].str,"3:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[2].x,
					scene[1].objects2D[i]->coords[2].y);
			};
			if (scene[1].objects2D[i]->tip == Quad){
				scene[1].objects2D[i]->coords[3].x += xt;
				scene[1].objects2D[i]->coords[3].y += yt;
				for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"3") !=0 ; k++);
				sprintf(scene[1].texte[k].str,"4:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[3].x,
					scene[1].objects2D[i]->coords[3].y);
			};
			strcpy(scene[1].texte[ix].str,"0.0");
			strcpy(scene[1].texte[iy].str,"0.0");
		};
		if (strcmp(lastbutton , "Scaleaza") == 0) {
			int ix,iy,i,k,ipx,ipy;
			float xt,yt,px,py;
			for (ix = 0 ; ix < scene[1].texte.size() && strcmp(scene[1].texte[ix].comm,"Sx") !=0 ; ix++);
			xt = atof(scene[1].texte[ix].str);
			for (iy = 0 ; iy < scene[1].texte.size() && strcmp(scene[1].texte[iy].comm,"Sy") !=0 ; iy++);
			yt = atof(scene[1].texte[iy].str);
			for (ipx = 0 ; ipx < scene[1].texte.size() && strcmp(scene[1].texte[ipx].comm,"Px") !=0 ; ipx++);
			for (ipy = 0 ; ipy < scene[1].texte.size() && strcmp(scene[1].texte[ipy].comm,"Py") !=0 ; ipy++);
			px = atof(scene[1].texte[ipx].str);
			py = atof(scene[1].texte[ipy].str);
			for (i = 0 ; i < scene[1].objects2D.size() && strcmp(scene[1].objects2D[i]->comm,"Obiect") !=0 ; i++);
			scene[1].objects2D[i]->coords[0].x = scene[1].objects2D[i]->coords[0].x*xt+px-px*xt;
			scene[1].objects2D[i]->coords[0].y = scene[1].objects2D[i]->coords[0].y*yt+py-py*yt;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"0") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"1:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[0].x,
				scene[1].objects2D[i]->coords[0].y);
			scene[1].objects2D[i]->coords[1].x = scene[1].objects2D[i]->coords[1].x*xt+px-px*xt;
			scene[1].objects2D[i]->coords[1].y = scene[1].objects2D[i]->coords[1].y*yt+py-py*yt;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"1") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"2:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[1].x,
				scene[1].objects2D[i]->coords[1].y);
			if (scene[1].objects2D[i]->tip != Line){
				scene[1].objects2D[i]->coords[2].x = scene[1].objects2D[i]->coords[2].x*xt+px-px*xt;
				scene[1].objects2D[i]->coords[2].y = scene[1].objects2D[i]->coords[2].y*yt+py-py*yt;
				for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"2") !=0 ; k++);
				sprintf(scene[1].texte[k].str,"3:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[2].x,
					scene[1].objects2D[i]->coords[2].y);
			};
			if (scene[1].objects2D[i]->tip == Quad){
				scene[1].objects2D[i]->coords[3].x = scene[1].objects2D[i]->coords[3].x*xt+px-px*xt;
				scene[1].objects2D[i]->coords[3].y = scene[1].objects2D[i]->coords[3].y*yt+py-py*yt;
				for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"3") !=0 ; k++);
				sprintf(scene[1].texte[k].str,"4:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[3].x,
					scene[1].objects2D[i]->coords[3].y);
			};
			strcpy(scene[1].texte[ix].str,"1.0");
			strcpy(scene[1].texte[iy].str,"1.0");
			strcpy(scene[1].texte[ipx].str,"0.0");
			strcpy(scene[1].texte[ipy].str,"0.0");
		};
		if (strcmp(lastbutton , "Roteste") == 0) {
			int u,ix,iy,i,k,ipx,ipy;
			float cosu, sinu,px,py ;
			for (ix = 0 ; ix < scene[1].texte.size() && strcmp(scene[1].texte[ix].comm,"R") !=0 ; ix++);
			u = atoi(scene[1].texte[ix].str);
			cosu = cos(3.14159265 * (float)u/180);
			sinu = sin(3.14159265 * (float) u/180);
			printf("%f\n",cosu);
			for (ipx = 0 ; ipx < scene[1].texte.size() && strcmp(scene[1].texte[ipx].comm,"Px") !=0 ; ipx++);
			for (ipy = 0 ; ipy < scene[1].texte.size() && strcmp(scene[1].texte[ipy].comm,"Py") !=0 ; ipy++);
			px = atof(scene[1].texte[ipx].str);
			py = atof(scene[1].texte[ipy].str);
			for (i = 0 ; i < scene[1].objects2D.size() && strcmp(scene[1].objects2D[i]->comm,"Obiect") !=0 ; i++);
			scene[1].objects2D[i]->coords[0].x = (scene[1].objects2D[i]->coords[0].x-px) * cosu -
				(scene[1].objects2D[i]->coords[0].y-py) * sinu + px;
			scene[1].objects2D[i]->coords[0].y = (scene[1].objects2D[i]->coords[0].x-px) * sinu +
				(scene[1].objects2D[i]->coords[0].y-py) * cosu + py;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"0") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"1:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[0].x,
				scene[1].objects2D[i]->coords[0].y);
			scene[1].objects2D[i]->coords[1].x = (scene[1].objects2D[i]->coords[1].x-px) * cosu -
				(scene[1].objects2D[i]->coords[1].y-py) * sinu + px;
			scene[1].objects2D[i]->coords[1].y = (scene[1].objects2D[i]->coords[1].x-px) * sinu +
				(scene[1].objects2D[i]->coords[1].y-py) * cosu + py;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"1") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"2:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[1].x,
				scene[1].objects2D[i]->coords[1].y);
			if (scene[1].objects2D[i]->tip != Line){
				scene[1].objects2D[i]->coords[2].x = (scene[1].objects2D[i]->coords[2].x-px) * cosu -
					(scene[1].objects2D[i]->coords[2].y-py) * sinu + px;
				scene[1].objects2D[i]->coords[2].y = (scene[1].objects2D[i]->coords[2].x-px) * sinu +
					(scene[1].objects2D[i]->coords[2].y-py) * cosu + py;
				for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"2") !=0 ; k++);
				sprintf(scene[1].texte[k].str,"3:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[2].x,
					scene[1].objects2D[i]->coords[2].y);
			};
			if (scene[1].objects2D[i]->tip == Quad){
				scene[1].objects2D[i]->coords[3].x = (scene[1].objects2D[i]->coords[3].x-px) * cosu -
					(scene[1].objects2D[i]->coords[3].y-py) * sinu + px;
				scene[1].objects2D[i]->coords[3].y = (scene[1].objects2D[i]->coords[3].x-px) * sinu +
					(scene[1].objects2D[i]->coords[3].y-py) * cosu + py;
				for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"3") !=0 ; k++);
				sprintf(scene[1].texte[k].str,"4:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[3].x,
					scene[1].objects2D[i]->coords[3].y);
			};
			strcpy(scene[1].texte[ix].str,"0");
			strcpy(scene[1].texte[ipx].str,"0.0");
			strcpy(scene[1].texte[ipy].str,"0.0");
		};
		if (strcmp(lastbutton , "Linie") == 0) {
			int i;
			float x[4],y[4],z[4];
			for (i = 0 ; i < scene[1].objects2D.size() && strcmp(scene[1].objects2D[i]->comm,"Obiect") !=0 ; i++);
			x[0] = 3.0f;y[0] = 2.0f;x[1] = 6.0f;	y[1] = 2.0f;x[2] = 6.0f;	y[2] = 5.0f;x[3] = 3.0f;	y[3] = 5.0f;	
			z[0] = z[1] = z[2] = z[3]=0.0f;
			scene[1].objects2D[i]->SetCoords(x,y,z);
			scene[1].objects2D[i]->SetDrawLines(1);
			scene[1].objects2D[i]->tip = Line;
			int k;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"0") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"1:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[0].x,
				scene[1].objects2D[i]->coords[0].y);
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"1") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"2:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[1].x,
				scene[1].objects2D[i]->coords[1].y);
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"2") !=0 ; k++);
			scene[1].texte[k].Visible = false;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"3") !=0 ; k++);
			scene[1].texte[k].Visible = false;
		};
		if (strcmp(lastbutton , "Triunghi") == 0) {
			int i;
			float x[4],y[4],z[4];
			for (i = 0 ; i < scene[1].objects2D.size() && strcmp(scene[1].objects2D[i]->comm,"Obiect") !=0 ; i++);
			x[0] = 3.0f;y[0] = 2.0f;x[1] = 6.0f;	y[1] = 2.0f;x[2] = 6.0f;	y[2] = 5.0f;x[3] = 3.0f;	y[3] = 5.0f;	
			z[0] = z[1] = z[2] = z[3] = 0.0f;
			scene[1].objects2D[i]->SetCoords(x,y,z);
			scene[1].objects2D[i]->SetDrawLines(1);
			scene[1].objects2D[i]->SetTip(Triangle);
			int k;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"0") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"1:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[0].x,
				scene[1].objects2D[i]->coords[0].y);
			scene[1].texte[k].Visible = true;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"1") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"2:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[1].x,
				scene[1].objects2D[i]->coords[1].y);
			scene[1].texte[k].Visible = true;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"2") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"3:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[2].x,
				scene[1].objects2D[i]->coords[2].y);
			scene[1].texte[k].Visible = true;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"3") !=0 ; k++);
			scene[1].texte[k].Visible = false;
		};
		if (strcmp(lastbutton , "Patrat") == 0) {
			int i;
			float x[4],y[4],z[4];
			for (i = 0 ; i < scene[1].objects2D.size() && strcmp(scene[1].objects2D[i]->comm,"Obiect") !=0 ; i++);
			x[0] = 3.0f;y[0] = 2.0f;x[1] = 6.0f;	y[1] = 2.0f;x[2] = 6.0f;	y[2] = 5.0f;x[3] = 3.0f;	y[3] = 5.0f;
			z[0] = z[1] = z[2] = 0.0f;
			scene[1].objects2D[i]->SetCoords(x,y,z);
			scene[1].objects2D[i]->SetDrawLines(1);
			scene[1].objects2D[i]->tip = Quad;
			int k;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"0") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"1:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[0].x,
				scene[1].objects2D[i]->coords[0].y);
			scene[1].texte[k].Visible = true;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"1") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"2:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[1].x,
				scene[1].objects2D[i]->coords[1].y);
			scene[1].texte[k].Visible = true;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"2") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"3:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[2].x,
				scene[1].objects2D[i]->coords[2].y);
			scene[1].texte[k].Visible = true;
			for (k = 0 ; k < scene[1].texte.size() && strcmp(scene[1].texte[k].comm,"3") !=0 ; k++);
			sprintf(scene[1].texte[k].str,"4:    %.1f     %.1f  ",scene[1].objects2D[i]->coords[3].x,
				scene[1].objects2D[i]->coords[3].y);
			scene[1].texte[k].Visible = true;
		};
		if (strcmp(lastbutton , "Meniu") == 0) {
			current_scene = 0;
			glutDestroyWindow(winIdSub);
			glutDestroyWindow(winIdMain);
			winIdMain = glutCreateWindow (TITLE); 
			glutDisplayFunc (mainDisplay); 
			glutReshapeFunc (mainReshape); 
			glutKeyboardFunc (keyboard); 
			glutIdleFunc (idle);

			winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
			glutDisplayFunc (subDisplay); 
			glutReshapeFunc (subReshape); 
			glutMouseFunc(MouseButton);
			glutMotionFunc(MouseMotion);
			glutPassiveMotionFunc(MousePassiveMotion);
		}
	};
	if (current_scene == 2) 
	{
		if (strcmp(lastbutton , "Tx_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Tx") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Tx_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Tx") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Ty_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Ty") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Ty_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Ty") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Tz_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Tz") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Tz_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Tz") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Sx_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Sx") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Sx_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Sx") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Sy_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Sy") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Sy_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Sy") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Sz_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Sz") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)-0.5f);
		};
		if (strcmp(lastbutton , "Sz_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Sz") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%.1f",atof(scene[2].texte[i].str)+0.5f);
		};
		if (strcmp(lastbutton , "Rx_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Rx") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%d",atoi(scene[2].texte[i].str)-5);
		};
		if (strcmp(lastbutton , "Rx_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Rx") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%d",atoi(scene[2].texte[i].str)+5);
		};
		if (strcmp(lastbutton , "Ry_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Ry") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%d",atoi(scene[2].texte[i].str)-5);
		};
		if (strcmp(lastbutton , "Ry_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Ry") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%d",atoi(scene[2].texte[i].str)+5);
		};
		if (strcmp(lastbutton , "Rz_mic") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Rz") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%d",atoi(scene[2].texte[i].str)-5);
		};
		if (strcmp(lastbutton , "Rz_mare") == 0) {
			int i;
			for (i = 0 ; i < scene[2].texte.size() && strcmp(scene[2].texte[i].comm,"Rz") !=0 ; i++);
			sprintf(scene[2].texte[i].str,"%d",atoi(scene[2].texte[i].str)+5);
		};		
		if (strcmp(lastbutton , "Aplica") == 0) {
			int ix,iy,iz,i,k;
			float xt,yt , zt,xs,ys,zs,xr,yr,zr;
			for (ix = 0 ; ix < scene[2].texte.size() && strcmp(scene[2].texte[ix].comm,"Tx") !=0 ; ix++);
			xt = atof(scene[2].texte[ix].str);
			for (iy = 0 ; iy < scene[2].texte.size() && strcmp(scene[2].texte[iy].comm,"Ty") !=0 ; iy++);
			yt = atof(scene[2].texte[iy].str);
			for (iz = 0 ; iz < scene[2].texte.size() && strcmp(scene[2].texte[iz].comm,"Tz") !=0 ; iz++);
			zt = atof(scene[2].texte[iz].str);
			strcpy(scene[2].texte[ix].str,"0.0");
			strcpy(scene[2].texte[iy].str,"0.0");
			strcpy(scene[2].texte[iz].str,"0.0");

			for (ix = 0 ; ix < scene[2].texte.size() && strcmp(scene[2].texte[ix].comm,"Sx") !=0 ; ix++);
			xs = atof(scene[2].texte[ix].str);
			for (iy = 0 ; iy < scene[2].texte.size() && strcmp(scene[2].texte[iy].comm,"Sy") !=0 ; iy++);
			ys = atof(scene[2].texte[iy].str);
			for (iz = 0 ; iz < scene[2].texte.size() && strcmp(scene[2].texte[iz].comm,"Sz") !=0 ; iz++);
			zs = atof(scene[2].texte[iz].str);
			strcpy(scene[2].texte[ix].str,"1.0");
			strcpy(scene[2].texte[iy].str,"1.0");
			strcpy(scene[2].texte[iz].str,"1.0");

			for (ix = 0 ; ix < scene[2].texte.size() && strcmp(scene[2].texte[ix].comm,"Rx") !=0 ; ix++);
			xr = atof(scene[2].texte[ix].str);
			for (iy = 0 ; iy < scene[2].texte.size() && strcmp(scene[2].texte[iy].comm,"Ry") !=0 ; iy++);
			yr = atof(scene[2].texte[iy].str);
			for (iz = 0 ; iz < scene[2].texte.size() && strcmp(scene[2].texte[iz].comm,"Rz") !=0 ; iz++);
			zr = atof(scene[2].texte[iz].str);
			strcpy(scene[2].texte[ix].str,"0");
			strcpy(scene[2].texte[iy].str,"0");
			strcpy(scene[2].texte[iz].str,"0");

			for (i = 0 ; i < scene[2].objects2D.size() && strcmp(scene[2].objects2D[i]->comm,"Obiect") !=0 ; i++);

			scene[2].objects3D[i]->SetTranslat(xt,yt,zt);
			scene[2].objects3D[i]->SetScalare(xs,ys,zs);			
			scene[2].objects3D[i]->SetRotatie(xr,yr,zr);
		};
		if (strcmp(lastbutton , "Sfera") == 0) {
			int i;
			for (i = 0 ; i < scene[2].objects3D.size() && strcmp(scene[2].objects3D[i]->comm,"Obiect") !=0 ; i++);
			scene[2].objects3D[i]->SetTip(Sphere);
			scene[2].objects3D[i]->translat[0] = scene[2].objects3D[i]->translat[2] = 0.0;
			scene[2].objects3D[i]->translat[1] = -1.0f;
			scene[2].objects3D[i]->scalare[0] = scene[2].objects3D[i]->scalare[1] = scene[2].objects3D[i]->scalare[2] = 1.0;
			scene[2].objects3D[i]->rotatie[0] = scene[2].objects3D[i]->rotatie[1] = scene[2].objects3D[i]->rotatie[2] = 0.0;
			scene[2].objects3D[i]->SetLevelOfDetail(25.0f);
		};
		if (strcmp(lastbutton , "Cub") == 0) {
			int i;
			for (i = 0 ; i < scene[2].objects3D.size() && strcmp(scene[2].objects3D[i]->comm,"Obiect") !=0 ; i++);
			scene[2].objects3D[i]->SetTip(Cube);
			scene[2].objects3D[i]->translat[0] = scene[2].objects3D[i]->translat[2] = 0.0;
			scene[2].objects3D[i]->translat[1] = -1.0f;
			scene[2].objects3D[i]->scalare[0] = scene[2].objects3D[i]->scalare[1] = scene[2].objects3D[i]->scalare[2] = 1.0;
			scene[2].objects3D[i]->rotatie[0] = scene[2].objects3D[i]->rotatie[1] = scene[2].objects3D[i]->rotatie[2] = 0.0;
			scene[2].objects3D[i]->SetLevelOfDetail(25.0f);
		};
		if (strcmp(lastbutton , "Con") == 0) {
			int i;
			for (i = 0 ; i < scene[2].objects3D.size() && strcmp(scene[2].objects3D[i]->comm,"Obiect") !=0 ; i++);
			scene[2].objects3D[i]->SetTip(Cone);
			scene[2].objects3D[i]->translat[0] = scene[2].objects3D[i]->translat[2] = 0.0;
			scene[2].objects3D[i]->translat[1] = -1.0f;
			scene[2].objects3D[i]->scalare[0] = scene[2].objects3D[i]->scalare[1] = scene[2].objects3D[i]->scalare[2] = 1.0;
			scene[2].objects3D[i]->rotatie[0] = scene[2].objects3D[i]->rotatie[1] = scene[2].objects3D[i]->rotatie[2] = 0.0;
			scene[2].objects3D[i]->rotatie[0] = -90;
			scene[2].objects3D[i]->SetLevelOfDetail(25.0f);
		};
		if (strcmp(lastbutton , "Meniu") == 0) {
			current_scene = 0;
			glutDestroyWindow(winIdSub);
			glutDestroyWindow(winIdMain);
			winIdMain = glutCreateWindow (TITLE); 
			glutDisplayFunc (mainDisplay); 
			glutReshapeFunc (mainReshape); 
			glutKeyboardFunc (keyboard); 
			glutIdleFunc (idle);

			winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
			glutDisplayFunc (subDisplay); 
			glutReshapeFunc (subReshape); 
			glutMouseFunc(MouseButton);
			glutMotionFunc(MouseMotion);
			glutPassiveMotionFunc(MousePassiveMotion);
		}
	};
	if (current_scene == 3) {
		int ix,ileft,iright,itop,ibottom,inear,ifar,iPyrn,iPyrf,iProiec;
		float lef, righ, to, botto, nea,fa;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Dreapta") !=0 ; ix++);
		righ = atof(scene[3].texte[ix].str);
		printf("\n\n%f\n\n",righ);
		iright = ix;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Stanga") !=0 ; ix++);
		lef = atof(scene[3].texte[ix].str);
		ileft = ix;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Sus") !=0 ; ix++);
		to = atof(scene[3].texte[ix].str);
		itop = ix;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Jos") !=0 ; ix++);
		botto = atof(scene[3].texte[ix].str);
		ibottom = ix;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Aproape") !=0 ; ix++);
		nea = atof(scene[3].texte[ix].str);
		inear = ix;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Departe") !=0 ; ix++);
		fa = atof(scene[3].texte[ix].str);
		ifar = ix;
		for (ix = 0 ; ix < scene[3].objects3D.size() && strcmp(scene[3].objects3D[ix]->comm,"Near") !=0 ; ix++);
		iPyrn = ix;
		for (ix = 0 ; ix < scene[3].objects3D.size() && strcmp(scene[3].objects3D[ix]->comm,"Far") !=0 ; ix++);
		iPyrf = ix;
		for (ix = 0 ; ix < scene[3].texte.size() && strcmp(scene[3].texte[ix].comm,"Proiectie") !=0 ; ix++);
		iProiec = ix;
		if (strcmp(lastbutton , "Dreapta_mic") == 0) {
			righ -= 0.1f;
			sprintf(scene[3].texte[iright].str,"%.1f",righ);
		};
		if (strcmp(lastbutton , "Dreapta_mare") == 0) {
			righ += 0.1f;
			sprintf(scene[3].texte[iright].str,"%.1f",righ);
		};
		if (strcmp(lastbutton , "Stanga_mic") == 0) {
			lef -= 0.1f;
			sprintf(scene[3].texte[ileft].str,"%.1f",lef);
		};
		if (strcmp(lastbutton , "Stanga_mare") == 0) {
			lef += 0.1f;
			sprintf(scene[3].texte[ileft].str,"%.1f",lef);
		};
		if (strcmp(lastbutton , "Aproape_mic") == 0) {
			nea -= 0.1f;
			sprintf(scene[3].texte[inear].str,"%.1f",nea);
		};
		if (strcmp(lastbutton , "Aproape_mare") == 0) {
			nea += 0.1f;
			sprintf(scene[3].texte[inear].str,"%.1f",nea);
		};
		if (strcmp(lastbutton , "Departe_mic") == 0) {
			fa -= 0.1f;
			sprintf(scene[3].texte[ifar].str,"%.1f",fa);
		};
		if (strcmp(lastbutton , "Departe_mare") == 0) {
			fa += 0.1f;
			sprintf(scene[3].texte[ifar].str,"%.1f",fa);
		};
		if (strcmp(lastbutton , "Sus_mic") == 0) {
			to -= 0.1f;
			sprintf(scene[3].texte[itop].str,"%.1f",to);
		};
		if (strcmp(lastbutton , "Sus_mare") == 0) {
			to += 0.1f;
			sprintf(scene[3].texte[itop].str,"%.1f",to);
		};
		if (strcmp(lastbutton , "Jos_mic") == 0) {
			botto -= 0.1f;
			sprintf(scene[3].texte[ibottom].str,"%.1f",botto);
		};
		if (strcmp(lastbutton , "Jos_mare") == 0) {
			botto += 0.1f;
			sprintf(scene[3].texte[ibottom].str,"%.1f",botto);
		};
		float coor_x[9],coor_y[9],coor_z[9];


		if (strcmp(lastbutton , "Scena") == 0) {
			scene[3].use_custom = false;
		}
		if (strcmp(lastbutton , "Vezi") == 0) {
			scene[3].use_custom = true;
		}
		if (strcmp(lastbutton , "Ortografica") == 0) {
			scene[3].custom_orto = true;
			strcpy(scene[3].texte[iProiec].str,"Ortografica");
		}
		if (strcmp(lastbutton , "Perspectiva") == 0) {
			scene[3].custom_orto = false;
			strcpy(scene[3].texte[iProiec].str,"Perspectiva");
		}
		if (scene[3].custom_orto == true)
		{
			scene[3].objects3D[iPyrn]->SetTip(Block);
			scene[3].objects3D[iPyrf]->SetTip(Block);
			coor_x[0] = lef; coor_y[0]=to ; coor_z[0] = nea;
			coor_x[1] = righ; coor_y[1]= to;coor_z[1] = nea;
			coor_x[2] = righ;coor_y[2]= botto;coor_z[2] = nea;
			coor_x[3] = lef;coor_y[3]= botto;coor_z[3] = nea;
			coor_x[4] = lef; coor_y[4]=to ; coor_z[4] = fa;
			coor_x[5] = righ; coor_y[5]= to;coor_z[5] = fa;
			coor_x[6] = righ;coor_y[6]= botto;coor_z[6] = fa;
			coor_x[7] = lef;coor_y[7]= botto;coor_z[7] = fa;
			scene[3].objects3D[iPyrn]->SetCoords(coor_x,coor_y,coor_z);
			scene[3].objects3D[iPyrf]->SetCoords(coor_x,coor_y,coor_z);
		}
		else
		{
			scene[3].objects3D[iPyrn]->SetTip(Pyramid);
			scene[3].objects3D[iPyrf]->SetTip(Pyramid);
			coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
			coor_x[1] = lef; coor_y[1]=to ; coor_z[1] = nea;
			coor_x[2] = righ; coor_y[2]= to;coor_z[2] = nea;
			coor_x[3] = righ;coor_y[3]= botto;coor_z[3] = nea;
			coor_x[4] = lef;coor_y[4]= botto;coor_z[4] = nea;
			scene[3].objects3D[iPyrn]->SetCoords(coor_x,coor_y,coor_z);

			coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
			coor_x[1] = (float)lef * ((float)fa/nea); coor_y[1] = to * ((float)fa/nea) ; coor_z[1] = fa;
			coor_x[2] = righ * ((float)fa/nea); coor_y[2]= to * ((float)fa/nea);coor_z[2] = fa;
			coor_x[3] = righ * ((float)fa/nea);coor_y[3]= botto * ((float)fa/nea);coor_z[3] = fa;
			coor_x[4] = lef * ((float)fa/nea);coor_y[4]= botto * ((float)fa/nea);coor_z[4] = fa;
			scene[3].objects3D[iPyrf]->SetCoords(coor_x,coor_y,coor_z);
		}
		if (scene[3].use_custom == true) 
		{
			scene[3].proj_args[0] = lef;
			scene[3].proj_args[1] = righ;
			scene[3].proj_args[2] = botto;
			scene[3].proj_args[3] = to;
			scene[3].proj_args[4] = nea;
			scene[3].proj_args[5] = fa;
			glutSetWindow (winIdMain);
			glViewport(0,0, WIDTH,HEIGHT);
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			if (scene[3].custom_orto)
				glOrtho(scene[3].proj_args[0], scene[3].proj_args[1], scene[3].proj_args[2], scene[3].proj_args[3],scene[3].proj_args[4],scene[3].proj_args[5]);
			else
				glFrustum(scene[3].proj_args[0], scene[3].proj_args[1], scene[3].proj_args[2], scene[3].proj_args[3],scene[3].proj_args[4],scene[3].proj_args[5]);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity(); 
			glutPostRedisplay();
		}
		else{
			glutSetWindow (winIdMain);
			glViewport(0,0, WIDTH,HEIGHT);
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			const double DEG2RAD = 3.14159265 / 180;
			double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
			double height = 1 * tangent;          // half height of near plane
			double width = height * (float)WIDTH/HEIGHT;
			scene[3].proj_args[0] = -width;
			scene[3].proj_args[1] = width;
			scene[3].proj_args[2] = -height;
			scene[3].proj_args[3] = height;
			scene[3].proj_args[4] = 1;
			scene[3].proj_args[5] = 60;
			glFrustum(scene[3].proj_args[0], scene[3].proj_args[1], scene[3].proj_args[2], scene[3].proj_args[3],scene[3].proj_args[4],scene[3].proj_args[5]);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity(); 
			glutPostRedisplay();
		}
		if (strcmp(lastbutton , "Meniu") == 0) {
			current_scene = 0;
			glutDestroyWindow(winIdSub);
			glutDestroyWindow(winIdMain);
			winIdMain = glutCreateWindow (TITLE); 
			glutDisplayFunc (mainDisplay); 
			glutReshapeFunc (mainReshape); 
			glutKeyboardFunc (keyboard); 
			glutIdleFunc (idle);

			winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
			glutDisplayFunc (subDisplay); 
			glutReshapeFunc (subReshape); 
			glutMouseFunc(MouseButton);
			glutMotionFunc(MouseMotion);
			glutPassiveMotionFunc(MousePassiveMotion);
		}

	};
	if (current_scene == 4 )
	{
		int ix,iObs, iFor,iUp,iInaintex,iInaintey,iInaintez,iSusx,iSusy,iSusz,iPozx,iPozy,iPozz;
		float Inaintex,Inaintey,Inaintez,Susx,Susy,Susz,Pozx,Pozy,Pozz;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Inaintex") !=0 ; ix++);
		Inaintex = atof(scene[4].texte[ix].str);
		iInaintex = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Inaintey") !=0 ; ix++);
		Inaintey = atof(scene[4].texte[ix].str);
		iInaintey = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Inaintez") !=0 ; ix++);
		Inaintez = atof(scene[4].texte[ix].str);
		iInaintez = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Susx") !=0 ; ix++);
		Susx = atof(scene[4].texte[ix].str);
		iSusx = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Susy") !=0 ; ix++);
		Susy = atof(scene[4].texte[ix].str);
		iSusy = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Susz") !=0 ; ix++);
		Susz = atof(scene[4].texte[ix].str);
		iSusz = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Pozitiex") !=0 ; ix++);
		Pozx = atof(scene[4].texte[ix].str);
		iPozx = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Pozitiey") !=0 ; ix++);
		Pozy = atof(scene[4].texte[ix].str);
		iPozy = ix;
		for (ix = 0 ; ix < scene[4].texte.size() && strcmp(scene[4].texte[ix].comm,"Pozitiez") !=0 ; ix++);
		Pozz = atof(scene[4].texte[ix].str);
		iPozz = ix;
		for (ix = 0 ; ix < scene[4].objects3D.size() && strcmp(scene[4].objects3D[ix]->comm,"Observ") !=0 ; ix++);
		iObs = ix;
		for (ix = 0 ; ix < scene[4].objects3D.size() && strcmp(scene[4].objects3D[ix]->comm,"Forwardv") !=0 ; ix++);
		iFor = ix;
		for (ix = 0 ; ix < scene[4].objects3D.size() && strcmp(scene[4].objects3D[ix]->comm,"Upv") !=0 ; ix++);
		iUp = ix;
		if (strcmp(lastbutton,"Inaintex_mic") == 0){
			Inaintex -= 0.1;
			sprintf(scene[4].texte[iInaintex].str,"%.1f",Inaintex);
		}
		if (strcmp(lastbutton,"Inaintex_mare") == 0){
			Inaintex += 0.1;
			sprintf(scene[4].texte[iInaintex].str,"%.1f",Inaintex);
		}
		if (strcmp(lastbutton,"Inaintey_mic") == 0){
			Inaintey -= 0.1;
			sprintf(scene[4].texte[iInaintey].str,"%.1f",Inaintey);
		}
		if (strcmp(lastbutton,"Inaintey_mare") == 0){
			Inaintey += 0.1;
			sprintf(scene[4].texte[iInaintey].str,"%.1f",Inaintey);
		}
		if (strcmp(lastbutton,"Inaintez_mic") == 0){
			Inaintez -= 0.1;
			sprintf(scene[4].texte[iInaintez].str,"%.1f",Inaintez);
		}
		if (strcmp(lastbutton,"Inaintez_mare") == 0){
			Inaintez += 0.1;
			sprintf(scene[4].texte[iInaintez].str,"%.1f",Inaintez);
		}
		if (strcmp(lastbutton,"Susx_mic") == 0){
			Susx -= 0.1;
			sprintf(scene[4].texte[iSusx].str,"%.1f",Susx);
		}
		if (strcmp(lastbutton,"Susx_mare") == 0){
			Susx += 0.1;
			sprintf(scene[4].texte[iSusx].str,"%.1f",Susx);
		}
		if (strcmp(lastbutton,"Susy_mic") == 0){
			Susy -= 0.1;
			sprintf(scene[4].texte[iSusy].str,"%.1f",Susy);
		}
		if (strcmp(lastbutton,"Susy_mare") == 0){
			Susy += 0.1;
			sprintf(scene[4].texte[iSusy].str,"%.1f",Susy);
		}
		if (strcmp(lastbutton,"Susz_mic") == 0){
			Susz -= 0.1;
			sprintf(scene[4].texte[iSusz].str,"%.1f",Susz);
		}
		if (strcmp(lastbutton,"Susz_mare") == 0){
			Susz += 0.1;
			sprintf(scene[4].texte[iSusz].str,"%.1f",Susz);
		}
		if (strcmp(lastbutton,"Pozitiex_mic") == 0){
			Pozx -= 0.1;
			sprintf(scene[4].texte[iPozx].str,"%.1f",Pozx);
		}
		if (strcmp(lastbutton,"Pozitiex_mare") == 0){
			Pozx += 0.1;
			sprintf(scene[4].texte[iPozx].str,"%.1f",Pozx);
		}
		if (strcmp(lastbutton,"Pozitiey_mic") == 0){
			Pozy -= 0.1;
			sprintf(scene[4].texte[iPozy].str,"%.1f",Pozy);
		}
		if (strcmp(lastbutton,"Pozitiey_mare") == 0){
			Pozy += 0.1;
			sprintf(scene[4].texte[iPozy].str,"%.1f",Pozy);
		}
		if (strcmp(lastbutton,"Pozitiez_mic") == 0){
			Pozz -= 0.1;
			sprintf(scene[4].texte[iPozz].str,"%.1f",Pozz);
		}
		if (strcmp(lastbutton,"Pozitiez_mare") == 0){
			Pozz += 0.1;
			sprintf(scene[4].texte[iPozz].str,"%.1f",Pozz);
		}
		scene[4].custom_cam->SetForwardVector(Inaintex,Inaintey,Inaintez);
		scene[4].custom_cam->SetUpVector(Susx,Susy,Susz);
		scene[4].custom_cam->SetPosition(Pozx,Pozy,Pozz);
		scene[4].objects3D[iObs]->translat[0] = scene[4].objects3D[iUp]->translat[0] = scene[4].objects3D[iFor]->translat[0] = Pozx;
		scene[4].objects3D[iObs]->translat[1] = scene[4].objects3D[iUp]->translat[1] = scene[4].objects3D[iFor]->translat[1] =Pozy;
		scene[4].objects3D[iObs]->translat[2] = scene[4].objects3D[iUp]->translat[2] = scene[4].objects3D[iFor]->translat[2] =Pozz;
		float coor_x[8],coor_y[8],coor_z[8];
		coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
		coor_x[1] = scene[4].custom_cam->ForwardVector[0]; coor_y[1]=scene[4].custom_cam->ForwardVector[1]; coor_z[1] = scene[4].custom_cam->ForwardVector[2];
		scene[4].objects3D[iFor]->SetCoords(coor_x,coor_y,coor_z);
		coor_x[0] = coor_y[0]= coor_z[0] = 0.0f;
		coor_x[1] = scene[4].custom_cam->UpVector[0]; coor_y[1]=scene[4].custom_cam->UpVector[1]; coor_z[1] = scene[4].custom_cam->UpVector[2];
		scene[4].objects3D[iUp]->SetCoords(coor_x,coor_y,coor_z);
		if (strcmp(lastbutton , "Scena") == 0) {
			scene[4].use_custom = false;
		}
		if (strcmp(lastbutton , "Vezi") == 0) {
			scene[4].use_custom = true;
		}
		if (scene[4].use_custom == true) 
		{
			glutSetWindow (winIdMain);
			glViewport(0,0, WIDTH,HEIGHT);
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			glFrustum(scene[4].proj_args[0], scene[4].proj_args[1], scene[4].proj_args[2], scene[4].proj_args[3],scene[4].proj_args[4],scene[4].proj_args[5]);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity(); 
			glutPostRedisplay();
		}
		else{
			glutSetWindow (winIdMain);
			glViewport(0,0, WIDTH,HEIGHT);
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			const double DEG2RAD = 3.14159265 / 180;
			double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
			double height = 1 * tangent;          // half height of near plane
			double width = height * (float)WIDTH/HEIGHT;
			scene[4].proj_args[0] = -width;
			scene[4].proj_args[1] = width;
			scene[4].proj_args[2] = -height;
			scene[4].proj_args[3] = height;
			scene[4].proj_args[4] = 1;
			scene[4].proj_args[5] = 60;
			glFrustum(scene[4].proj_args[0], scene[4].proj_args[1], scene[4].proj_args[2], scene[4].proj_args[3],scene[4].proj_args[4],scene[4].proj_args[5]);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity(); 
			glutPostRedisplay();
		}

		if (strcmp(lastbutton , "Meniu") == 0) {
			current_scene = 0;
			glutDestroyWindow(winIdSub);
			glutDestroyWindow(winIdMain);
			winIdMain = glutCreateWindow (TITLE); 
			glutDisplayFunc (mainDisplay); 
			glutReshapeFunc (mainReshape); 
			glutKeyboardFunc (keyboard); 
			glutIdleFunc (idle);

			winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
			glutDisplayFunc (subDisplay); 
			glutReshapeFunc (subReshape); 
			glutMouseFunc(MouseButton);
			glutMotionFunc(MouseMotion);
			glutPassiveMotionFunc(MousePassiveMotion);
		}
	};
	if ( current_scene == 5 ){
		int ix,iRd,iGd,iBd,iRa,iGa,iBa,iRs,iGs,iBs;
		float Rd,Gd,Bd,Ra,Ga,Ba,Rs,Gs,Bs;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Rd") !=0 ; ix++);
		Rd = atof(scene[5].texte[ix].str);
		iRd = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Gd") !=0 ; ix++);
		Gd = atof(scene[5].texte[ix].str);
		iGd = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Bd") !=0 ; ix++);
		Bd = atof(scene[5].texte[ix].str);
		iBd = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Ra") !=0 ; ix++);
		Ra = atof(scene[5].texte[ix].str);
		iRa = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Ga") !=0 ; ix++);
		Ga = atof(scene[5].texte[ix].str);
		iGa = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Ba") !=0 ; ix++);
		Ba = atof(scene[5].texte[ix].str);
		iBa = ix;		
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Rs") !=0 ; ix++);
		Rs = atof(scene[5].texte[ix].str);
		iRs = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Gs") !=0 ; ix++);
		Gs = atof(scene[5].texte[ix].str);
		iGs = ix;
		for (ix = 0 ; ix < scene[5].texte.size() && strcmp(scene[5].texte[ix].comm,"Bs") !=0 ; ix++);
		Bs = atof(scene[5].texte[ix].str);
		iBs = ix;
		if (strcmp(lastbutton,"Rd_mic") == 0 && Rd > 0){
			Rd -= 0.1;
			sprintf(scene[5].texte[iRd].str,"%.1f",Rd);
		}
		if (strcmp(lastbutton,"Rd_mare") == 0){
			Rd += 0.1;
			sprintf(scene[5].texte[iRd].str,"%.1f",Rd);
		}
		if (strcmp(lastbutton,"Gd_mic") == 0 && Gd > 0){
			Gd -= 0.1;
			sprintf(scene[5].texte[iGd].str,"%.1f",Gd);
		}
		if (strcmp(lastbutton,"Gd_mare") == 0){
			Gd += 0.1;
			sprintf(scene[5].texte[iGd].str,"%.1f",Gd);
		}
		if (strcmp(lastbutton,"Bd_mic") == 0 && Bd > 0){
			Bd -= 0.1;
			sprintf(scene[5].texte[iBd].str,"%.1f",Bd);
		}
		if (strcmp(lastbutton,"Bd_mare") == 0){
			Bd += 0.1;
			sprintf(scene[5].texte[iBd].str,"%.1f",Bd);
		}
		if (strcmp(lastbutton,"Ra_mic") == 0 && Ra > 0){
			Ra -= 0.1;
			sprintf(scene[5].texte[iRa].str,"%.1f",Ra);
		}
		if (strcmp(lastbutton,"Ra_mare") == 0){
			Ra += 0.1;
			sprintf(scene[5].texte[iRa].str,"%.1f",Ra);
		}
		if (strcmp(lastbutton,"Ga_mic") == 0 && Ga > 0){
			Ga -= 0.1;
			sprintf(scene[5].texte[iGa].str,"%.1f",Ga);
		}
		if (strcmp(lastbutton,"Ga_mare") == 0){
			Ga += 0.1;
			sprintf(scene[5].texte[iGa].str,"%.1f",Ga);
		}
		if (strcmp(lastbutton,"Ba_mic") == 0 && Ba > 0){
			Ba -= 0.1;
			sprintf(scene[5].texte[iBa].str,"%.1f",Ba);
		}
		if (strcmp(lastbutton,"Ba_mare") == 0){
			Ba += 0.1;
			sprintf(scene[5].texte[iBa].str,"%.1f",Ba);
		}
		if (strcmp(lastbutton,"Rs_mic") == 0 && Rs > 0){
			Rs -= 0.1;
			sprintf(scene[5].texte[iRs].str,"%.1f",Rs);
		}
		if (strcmp(lastbutton,"Rs_mare") == 0){
			Rs += 0.1;
			sprintf(scene[5].texte[iRs].str,"%.1f",Rs);
		}
		if (strcmp(lastbutton,"Gs_mic") == 0 && Gs > 0){
			Gs -= 0.1;
			sprintf(scene[5].texte[iGs].str,"%.1f",Gs);
		}
		if (strcmp(lastbutton,"Gs_mare") == 0){
			Gs += 0.1;
			sprintf(scene[5].texte[iGs].str,"%.1f",Gs);
		}
		if (strcmp(lastbutton,"Bs_mic") == 0 && Bs > 0){
			Bs -= 0.1;
			sprintf(scene[5].texte[iBs].str,"%.1f",Bs);
		}
		if (strcmp(lastbutton,"Bs_mare") == 0){
			Bs += 0.1;
			sprintf(scene[5].texte[iBs].str,"%.1f",Bs);
		}
		if (strcmp(lastbutton,"ResetD") == 0){
			Rd = 0;Gd = 0;Bd = 0;
			sprintf(scene[5].texte[iRd].str,"%.1f",Rd);
			sprintf(scene[5].texte[iGd].str,"%.1f",Gd);
			sprintf(scene[5].texte[iBd].str,"%.1f",Bd);
		}
		if (strcmp(lastbutton,"ResetA") == 0 ){
			Ra = 0;Ga = 0;Ba = 0;
			sprintf(scene[5].texte[iRa].str,"%.1f",Ra);
			sprintf(scene[5].texte[iGa].str,"%.1f",Ga);
			sprintf(scene[5].texte[iBa].str,"%.1f",Ba);
		}
		if (strcmp(lastbutton,"ResetS") == 0){
			Rs = 0;Gs = 0;Bs = 0;
			sprintf(scene[5].texte[iRs].str,"%.1f",Rs);
			sprintf(scene[5].texte[iGs].str,"%.1f",Gs);
			sprintf(scene[5].texte[iBs].str,"%.1f",Bs);
		}
		scene[5].lights[scene[5].selected]->SetDiffuse(Rd,Gd,Bd,1.0);
		scene[5].lights[scene[5].selected]->SetAmbient(Ra,Ga,Ba,1.0);
		scene[5].lights[scene[5].selected]->SetSpecular(Rs,Gs,Bs,0.0);

		if (strcmp(lastbutton , "Meniu") == 0) {
			initScenariu5();
			current_scene = 0;
			glutDestroyWindow(winIdSub);
			glutDestroyWindow(winIdMain);
			winIdMain = glutCreateWindow (TITLE); 
			glutDisplayFunc (mainDisplay); 
			glutReshapeFunc (mainReshape); 
			glutKeyboardFunc (keyboard); 
			glutIdleFunc (idle);

			winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
			glutDisplayFunc (subDisplay); 
			glutReshapeFunc (subReshape); 
			glutMouseFunc(MouseButton);
			glutMotionFunc(MouseMotion);
			glutPassiveMotionFunc(MousePassiveMotion);
		}
	};
	if (current_scene == 6) {
		int ix,iR,iG,iB,iAproape,iDeparte,iDensitate,iAlfa,iTip;
		float R,G,B,Aproape,Departe,Densitate,Alfa;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"R") !=0 ; ix++);
		R = atof(scene[6].texte[ix].str);
		iR = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"G") !=0 ; ix++);
		G = atof(scene[6].texte[ix].str);
		iG = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"B") !=0 ; ix++);
		B = atof(scene[6].texte[ix].str);
		iB = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"Aproape") !=0 ; ix++);
		Aproape = atof(scene[6].texte[ix].str);
		iAproape = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"Departe") !=0 ; ix++);
		Departe = atof(scene[6].texte[ix].str);
		iDeparte = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"Densitate") !=0 ; ix++);
		Densitate = atof(scene[6].texte[ix].str);
		iDensitate = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"Alfa") !=0 ; ix++);
		Alfa = atof(scene[6].texte[ix].str);
		iAlfa = ix;
		for (ix = 0 ; ix < scene[6].texte.size() && strcmp(scene[6].texte[ix].comm,"Tip") !=0 ; ix++);
		iTip = ix;
		if (strcmp(lastbutton,"R_mic") == 0 && R > 0){
			R -= 0.1;
			sprintf(scene[6].texte[iR].str,"%.1f",R);
		}
		if (strcmp(lastbutton,"R_mare") == 0){
			R += 0.1;
			sprintf(scene[6].texte[iR].str,"%.1f",R);
		}
		if (strcmp(lastbutton,"G_mic") == 0 && G > 0){
			G -= 0.1;
			sprintf(scene[6].texte[iG].str,"%.1f",G);
		}
		if (strcmp(lastbutton,"G_mare") == 0){
			G += 0.1;
			sprintf(scene[6].texte[iG].str,"%.1f",G);
		}
		if (strcmp(lastbutton,"B_mic") == 0 && B > 0){
			B -= 0.1;
			sprintf(scene[6].texte[iB].str,"%.1f",B);
		}
		if (strcmp(lastbutton,"B_mare") == 0){
			B += 0.1;
			sprintf(scene[6].texte[iB].str,"%.1f",B);
		}
		if (strcmp(lastbutton,"Aproape_mic") == 0 && Aproape > 0){
			Aproape -= 1.0;
			sprintf(scene[6].texte[iAproape].str,"%.1f",Aproape);
		}
		if (strcmp(lastbutton,"Aproape_mare") == 0){
			Aproape += 1.0;
			sprintf(scene[6].texte[iAproape].str,"%.1f",Aproape);
		}
		if (strcmp(lastbutton,"Departe_mic") == 0 && Departe > 0){
			Departe -= 1.0;
			sprintf(scene[6].texte[iDeparte].str,"%.1f",Departe);
		}
		if (strcmp(lastbutton,"Departe_mare") == 0){
			Departe += 1.0;
			sprintf(scene[6].texte[iDeparte].str,"%.1f",Departe);
		}
		if (strcmp(lastbutton,"Densitate_mic") == 0 && Densitate > 0){
			Densitate -= 0.01;
			sprintf(scene[6].texte[iDensitate].str,"%.2f",Densitate);
		}
		if (strcmp(lastbutton,"Densitate_mare") == 0){
			Densitate += 0.01;
			sprintf(scene[6].texte[iDensitate].str,"%.2f",Densitate);
		}
		if (strcmp(lastbutton,"Alfa_mic") == 0 && Alfa > 0){
			Alfa -= 0.1;
			sprintf(scene[6].texte[iAlfa].str,"%.1f",Alfa);
		}
		if (strcmp(lastbutton,"Alfa_mare") == 0){
			Alfa += 0.1;
			sprintf(scene[6].texte[iAlfa].str,"%.1f",Alfa);
		}
		if (strcmp(lastbutton,"Tip_mic") == 0){
			printf("\ndin %s->>>",scene[6].texte[iTip].str);
			if (strcmp(scene[6].texte[iTip].str,"Linear")== 0)
				sprintf(scene[6].texte[iTip].str,"EXP2");
			else
			if (strcmp(scene[6].texte[iTip].str,"EXP")== 0)
				sprintf(scene[6].texte[iTip].str,"Linear");
			else
			if (strcmp(scene[6].texte[iTip].str,"EXP2")== 0)
				sprintf(scene[6].texte[iTip].str,"EXP");
			printf("in %s\n",scene[6].texte[iTip].str);
		}
		if (strcmp(lastbutton,"Tip_mare") == 0){
			if (strcmp(scene[6].texte[iTip].str,"Linear")== 0)
				sprintf(scene[6].texte[iTip].str,"EXP");
			else
			if (strcmp(scene[6].texte[iTip].str,"EXP")== 0)
				sprintf(scene[6].texte[iTip].str,"EXP2");
			else
			if (strcmp(scene[6].texte[iTip].str,"EXP2")== 0)
				sprintf(scene[6].texte[iTip].str,"Linear");
		}
		scene[6].ceata.culoare[0] = R;
		scene[6].ceata.culoare[1] = G;
		scene[6].ceata.culoare[2] = B;
		scene[6].ceata.nearl = Aproape;
		scene[6].ceata.farl = Departe;
		scene[6].ceata.dens = Densitate;
		if (strcmp(scene[6].texte[iTip].str,"Linear") == 0)
			scene[6].ceata.type = LINIAR;
		if (strcmp(scene[6].texte[iTip].str,"EXP") == 0)
			scene[6].ceata.type = EXP;
		if (strcmp(scene[6].texte[iTip].str,"EXP2") == 0)
			scene[6].ceata.type = EXP2;
		scene[6].objects3D[scene[6].selected]->culoare[3] = Alfa;
if (strcmp(lastbutton , "Scena") == 0) {
			scene[6].use_custom = false;
		}
		if (strcmp(lastbutton , "Obs") == 0) {
			scene[6].use_custom = true;
		}
		if (scene[6].use_custom == true) 
		{
			glutSetWindow (winIdMain);
			glViewport(0,0, WIDTH,HEIGHT);
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			glFrustum(scene[6].proj_args[0], scene[6].proj_args[1], scene[6].proj_args[2], scene[6].proj_args[3],scene[6].proj_args[4],scene[6].proj_args[5]);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity(); 
			glutPostRedisplay();
		}
		else{
			glutSetWindow (winIdMain);
			glViewport(0,0, WIDTH,HEIGHT);
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			const double DEG2RAD = 3.14159265 / 180;
			double tangent = tan(45/2 * DEG2RAD);   // tangent of half fovY
			double height = 1 * tangent;          // half height of near plane
			double width = height * (float)WIDTH/HEIGHT;
			scene[6].proj_args[0] = -width;
			scene[6].proj_args[1] = width;
			scene[6].proj_args[2] = -height;
			scene[6].proj_args[3] = height;
			scene[6].proj_args[4] = 1;
			scene[6].proj_args[5] = 60;
			glFrustum(scene[6].proj_args[0], scene[6].proj_args[1], scene[6].proj_args[2], scene[6].proj_args[3],scene[6].proj_args[4],scene[6].proj_args[5]);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity(); 
			glutPostRedisplay();
		}
		if (strcmp(lastbutton , "Meniu") == 0) {
			initScenariu6();
			current_scene = 0;
			glutDestroyWindow(winIdSub);
			glutDestroyWindow(winIdMain);
			winIdMain = glutCreateWindow (TITLE); 
			glutDisplayFunc (mainDisplay); 
			glutReshapeFunc (mainReshape); 
			glutKeyboardFunc (keyboard); 
			glutIdleFunc (idle);

			winIdSub = glutCreateSubWindow( winIdMain, 5, 5, WIDTH - 10, HEIGHT / scene[current_scene].subheight); 
			glutDisplayFunc (subDisplay); 
			glutReshapeFunc (subReshape); 
			glutMouseFunc(MouseButton);
			glutMotionFunc(MouseMotion);
			glutPassiveMotionFunc(MousePassiveMotion);
		}
	};
};